]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fixes level toggling for logger set levels since it was reversed
authorJonathan Rose <jrose@digium.com>
Mon, 6 Jun 2011 19:07:56 +0000 (19:07 +0000)
committerJonathan Rose <jrose@digium.com>
Mon, 6 Jun 2011 19:07:56 +0000 (19:07 +0000)
(closes issue ASTERISK-17850)
Reported by: Luke H
Tested by: jrose, Luke H

Review: https://reviewboard.asterisk.org/r/1244/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@322069 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/logger.h
main/asterisk.c

index 91824d70440fe705007f17736b7cfc483fcbff9e..322214e739f65dca3a70c91f2f86d8e835b20396 100644 (file)
@@ -98,7 +98,10 @@ void ast_console_puts_mutable(const char *string, int level);
 void ast_console_toggle_mute(int fd, int silent);
 
 /*!
- * \since 1.6.1
+ * \brief enables or disables logging of a specified level to the console
+ * fd specifies the index of the console receiving the level change
+ * level specifies the index of the logging level being toggled
+ * state indicates whether logging will be on or off (0 for off, 1 for on)
  */
 void ast_console_toggle_loglevel(int fd, int level, int state);
 
index eed623b0614567ee7b0f916a64bcf9f8cc8add06..beba0679c5515b2efc90ec11002ef0546daa2768 100644 (file)
@@ -1082,12 +1082,19 @@ int ast_safe_system(const char *s)
        return res;
 }
 
+/*!
+ * \brief enable or disable a logging level to a specified console
+ */
 void ast_console_toggle_loglevel(int fd, int level, int state)
 {
        int x;
        for (x = 0;x < AST_MAX_CONNECTS; x++) {
                if (fd == consoles[x].fd) {
-                       consoles[x].levels[level] = state;
+                       /*
+                        * Since the logging occurs when levels are false, set to
+                        * flipped iinput because this function accepts 0 as off and 1 as on
+                        */
+                       consoles[x].levels[level] = state ? 0 : 1;
                        return;
                }
        }