speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/5] audio/alsa, audio/oss - Take the log level into account befo


From: Luke Yelavich
Subject: [PATCH 3/5] audio/alsa, audio/oss - Take the log level into account before logging a message.
Date: Tue, 23 Jun 2009 16:54:38 +1000

From: Luke Yelavich <address@hidden>
To: address@hidden

The MSG macro in the ALSA and OSS OUTPUT code logs messages to the log file
of the module without taking the log level setting into account. Adjust the
MSG macro to log the message if the log level for the message is equal to, or
less than the log level setting.
---
 ChangeLog        |    6 ++++++
 src/audio/alsa.c |    4 ++--
 src/audio/oss.c  |    4 ++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a00ce71..83955c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,12 @@
        * src/modules/module_main.c (main): Add a call to do_loglevel to set
        the log level for the module.
 
+       * src/audio/alsa.c: Adjust the MSG macro to take the log level setting
+       into account before logging a message.
+
+       * src/audio/oss.c: Adjust the MSG macro to take the log level setting
+       into account before logging a message.
+
 2009-06-22  Luke Yelavich <luke.yelavich at canonical.com>
 
        * src/server/output.c: Add output_send_loglevel_setting function
diff --git a/src/audio/alsa.c b/src/audio/alsa.c
index cfe2cc2..a25cc8b 100644
--- a/src/audio/alsa.c
+++ b/src/audio/alsa.c
@@ -56,8 +56,8 @@ do { \
 #endif
 
 /* Put a message into the logfile (stderr) */
-#define MSG(arg...) \
- { \
+#define MSG(level, arg...) \
+ if(level <= log_level){ \
      time_t t; \
      struct timeval tv; \
      char *tstr; \
diff --git a/src/audio/oss.c b/src/audio/oss.c
index f8cc4cb..a65f12e 100644
--- a/src/audio/oss.c
+++ b/src/audio/oss.c
@@ -38,8 +38,8 @@ int oss_play(AudioID *id, AudioTrack track);
 int oss_set_volume(AudioID*id, int volume);
 
 /* Put a message into the logfile (stderr) */
-#define MSG(arg...) \
- { \
+#define MSG(level, arg...) \
+ if(level <= log_level){ \
      time_t t; \
      struct timeval tv; \
      char *tstr; \
-- 
1.6.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]