Skip to content

Commit

Permalink
Rectify mapping to ASL log level
Browse files Browse the repository at this point in the history
1. Switch on logFlag rather than logLevel. logFlag varies per log messages,
   while logLevel is constant at file or even global scope.
2. Use the LOG_FLAG_* constants for each case clause.
  • Loading branch information
kastiglione committed Dec 2, 2012
1 parent 6c978fd commit 2621e7c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Lumberjack/DDASLLogger.m
Expand Up @@ -76,15 +76,15 @@ - (void)logMessage:(DDLogMessage *)logMessage
const char *msg = [logMsg UTF8String];

int aslLogLevel;
switch (logMessage->logLevel)
switch (logMessage->logFlag)
{
// Note: By default ASL will filter anything above level 5 (Notice).
// So our mappings shouldn't go above that level.

case 1 : aslLogLevel = ASL_LEVEL_CRIT; break;
case 2 : aslLogLevel = ASL_LEVEL_ERR; break;
case 3 : aslLogLevel = ASL_LEVEL_WARNING; break;
default : aslLogLevel = ASL_LEVEL_NOTICE; break;
case LOG_FLAG_ERROR : aslLogLevel = ASL_LEVEL_CRIT; break;
case LOG_FLAG_WARN : aslLogLevel = ASL_LEVEL_ERR; break;
case LOG_FLAG_INFO : aslLogLevel = ASL_LEVEL_WARNING; break;
default : aslLogLevel = ASL_LEVEL_NOTICE; break;
}

asl_log(client, NULL, aslLogLevel, "%s", msg);
Expand Down

0 comments on commit 2621e7c

Please sign in to comment.