Stefan Seyfried wrote:
> Hi,
> IMO the "header" of the logmessages is too long. I have experimented
> around with the attached patch, and it looks good to me:
>
>>Aug 5 19:51:00 strolchi [powersave][16913]: DIAG (readFrequencies:69)
>>cpu_max: 90, ratio: 1.334, hysteresis: 5 => down_threshold ((m/r)-h): 62
>>Aug 5 19:51:00 strolchi [powersave][16913]: DIAG (writeOndemand:86) On
>>demand config file
>>'/sys/devices/system/cpu/cpu0/cpufreq/ondemand/down_threshold' does not exist.
>>Aug 5 19:51:00 strolchi [powersave][16913]: DIAG (setBatteryAlarm:862)
>>Battery 0: Remaining capacity: 9000 last full capacity: 10000 Alarm will be
>>set to 1200 !
>>Aug 5 19:51:00 strolchi [powersave][16913]: DIAG (setBatteryAlarm:891)
>>failure. wrote: 1200, read: unsupported
>>Aug 5 19:51:00 strolchi [powersave][16913]: WARNING (ACPI_Interface:34)
>>could not set battery alarm, maybe you should force polling mode.
>>Aug 5 19:51:00 strolchi [powersave][16913]: DIAG (writeOndemand:86) On
>>demand config file
>>'/sys/devices/system/cpu/cpu0/cpufreq/ondemand/down_threshold' does not exist.
>>Aug 5 19:51:00 strolchi [powersave][16913]: DIAG (activateSettings:316)
>>Cooling mode is not supported by BIOS or the thermal module is not loaded,
>>nag your vendor to implement a
>>Aug 5 19:51:00 strolchi [powersave][16913]: DIAG (add_watch:29) Cannot
>>enable watch
>>Aug 5 19:51:01 strolchi [powersave-set_disk_settings][16932]: DIAG: Process
>>script for event daemon.scheme.change ID 2
>>Aug 5 19:51:01 strolchi [powersave][16913]: DIAG
>>(get_ACPI_General_Battery_Info:582) Battery capacity is equal to last
>>measurement,the battery should not be polled that often
>>Aug 5 19:51:03 strolchi [powersave][16913]: WARNING (filter_function:250)
>>Received message from invalid interface
>>Aug 5 19:51:03 strolchi [powersave][16913]: WARNING (filter_function:250)
>>Received message from invalid interface
>>Aug 5 19:51:03 strolchi [powersave][16913]: DIAG (filter_function:284)
>>Method sent to manager interface
>>Aug 5 19:51:03 strolchi [powersave][16913]: DIAG (handleDBusRequest:1875)
>>Handling manager request
>>Aug 5 19:51:03 strolchi [powersave][16913]: ERROR (filter_function:242)
>>Received error message: org.freedesktop.DBus.Error.ServiceUnknown
>>Aug 5 19:51:03 strolchi [powersave][16913]: DIAG (handleDBusRequest:2236)
>>err_code: 1, ret: 0 ('success')
>>Aug 5 19:51:03 strolchi [powersave][16913]: DIAG (handleDBusRequest:2236)
>>err_code: 1, ret: 0 ('success')
>>Aug 5 19:51:03 strolchi [powersave][16913]: DIAG (handleDBusRequest:2236)
>>err_code: 1, ret: 0 ('success')
>>Aug 5 19:51:05 strolchi [powersave][16913]: DIAG (filter_function:284)
>>Method sent to manager interface
>>Aug 5 19:51:05 strolchi [powersave][16913]: DIAG (handleDBusRequest:1875)
>>Handling manager request
>>Aug 5 19:51:05 strolchi [powersave][16913]: DIAG (handleDBusRequest:2236)
>>err_code: 1, ret: 0 ('success')
>
> still some of the messages are too long for my terminal, but it is a big
> better. Also i wondered if it really makes sense to _not_ print function
> and linenumber at levels info and debug, since if you need this great
> detail, the function and linenumber would fit in well.
> In fact, there are already many debug messages of the type
>
> pDebug(DBG_DEBUG, "%s", __FUNCTION__);
>
> so this is apparently actually needed ;-)
>
> If there are no objections, i'd like something like this to get in.
>
>
> ------------------------------------------------------------------------
>
> --- /tmp/powersave/powersave-0.10.6/libpower/powerlib.h 2005-07-20
> 11:19:49.000000000 +0200
> +++ powerlib.h 2005-08-05 19:50:11.000000000 +0200
> @@ -417,28 +417,28 @@ do{\
> openlog("[powersave]", LOG_PID, LOG_DAEMON); \
> syslog_open = 1; \
> } \
> - if (level == DBG_ERR && (DEBUG_LEVEL & DBG_ERR)){ \
> - syslog(LOG_ERR, "ERROR in Function %s; line %d: "string,
> __FUNCTION__, __LINE__, ## args); \
> - }else if (level == DBG_WARN && (DEBUG_LEVEL & DBG_WARN)) { \
> - syslog(LOG_WARNING, "WARNING in Function %s; line %d: "string,
> __FUNCTION__, __LINE__, ## args); \
> - }else if (level == DBG_DIAG && (DEBUG_LEVEL & DBG_DIAG)) { \
> - syslog(LOG_NOTICE, "DIAG in Function %s, line %d: "string,
> __FUNCTION__, __LINE__, ## args); \
> - }else if (level == DBG_INFO && (DEBUG_LEVEL & DBG_INFO)) {\
> - syslog(LOG_INFO, "Info: "string, ## args); \
> - }else if (level == DBG_DEBUG && (DEBUG_LEVEL & DBG_DEBUG)) {\
> - syslog(LOG_INFO, "Debug: "string, ## args); \
> + if (DEBUG_LEVEL & DBG_ERR & level){ \
> + syslog(LOG_ERR, "ERROR (%s:%d) "string, __FUNCTION__,
> __LINE__, ## args); \
> + }else if (DEBUG_LEVEL & DBG_WARN & level) { \
> + syslog(LOG_WARNING, "WARNING (%s:%d) "string, __FUNCTION__,
> __LINE__, ## args); \
> + }else if (DEBUG_LEVEL & DBG_DIAG & level) { \
> + syslog(LOG_NOTICE, "DIAG (%s:%d) "string, __FUNCTION__,
> __LINE__, ## args); \
> + }else if (DEBUG_LEVEL & DBG_INFO & level) {\
> + syslog(LOG_INFO, "Info: "string, ## args); \
> + }else if (DEBUG_LEVEL & DBG_DEBUG & level) {\
> + syslog(LOG_INFO, "Debug: "string, ## args); \
> } \
> }while(0);
> #else
> #define pDebug(level, string, args...) \
> do{\
> - if (level == DBG_ERR && (DEBUG_LEVEL & DBG_ERR)){ \
> - fprintf(stderr, "[POWERSAVE] ERROR in Function %s; line %d:
> "string, __FUNCTION__, __LINE__, ## args); \
> - }else if (level == DBG_WARN && (DEBUG_LEVEL & DBG_WARN)) { \
> - fprintf(stderr, "[POWERSAVE] WARNING in Function %s; line %d:
> "string, __FUNCTION__, __LINE__, ## args); \
> - }else if (level == DBG_DIAG && (DEBUG_LEVEL & DBG_DIAG)) { \
> - printf("[POWERSAVE] DIAG in Function %s, line %d: "string,
> __FUNCTION__, __LINE__, ## args); \
> - }else if (level == DBG_INFO && (DEBUG_LEVEL & DBG_INFO)) {\
> + if (DEBUG_LEVEL & DBG_ERR & level){ \
> + fprintf(stderr, "[POWERSAVE] ERROR (%s:%d) "string,
> __FUNCTION__, __LINE__, ## args); \
> + }else if (DEBUG_LEVEL & DBG_WARN & level) { \
> + fprintf(stderr, "[POWERSAVE] WARNING (%s:%d) "string,
> __FUNCTION__, __LINE__, ## args); \
> + }else if (DEBUG_LEVEL & DBG_DIAG & level) { \
> + printf("[POWERSAVE] DIAG (%s:%d) "string, __FUNCTION__,
> __LINE__, ## args); \
> + }else if (DEBUG_LEVEL & DBG_INFO & level) {\
> printf(" "string, ## args); \
> }else {\
> printf( ""string, ## args); \
>
>
Nice, I like it.
Just throw it in if you like.
Thomas
_______________________________________________
powersave-devel mailing list
[email protected]
http://forge.novell.com/mailman/listinfo/powersave-devel