Permalink
Browse files

Rectify mapping to ASL log level

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...
1 parent 6c978fd commit 2621e7c84729158c184e49694d5d74c2babe769d @kastiglione kastiglione committed Dec 2, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 Lumberjack/DDASLLogger.m
@@ -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);

0 comments on commit 2621e7c

Please sign in to comment.