Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added new flag DDVERBOSE to DDLog so you can have another state. #145

Merged
merged 4 commits into from

3 participants

@nicoyuste

Added new flag DDVERBOSE to DDLog so you can have another state.

@rivera-ernesto
Collaborator

I think an extra level is good, but the name is a little bit weird.

Most systems would have:

  • Error
  • Warning
  • Info
  • Debug (new one?)
  • Verbose
@bpoplauschi
Collaborator

I agree with @rivera-ernesto, the name is a little weird. I'm not sure why we would need an extra level, but if this helps people, I'm ok with that. For me, the 4 Error Warning Info Verbose represent the important categories of logs you might have and there is always the option to redefine them (https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomLogLevels)

@rivera-ernesto
Collaborator

So @nicoyuste what do you think about renaming it?

@nicoyuste
@bpoplauschi
Collaborator

@nicoyuste Yeap, I would go with:

  • Error
  • Warning
  • Info
  • Debug
  • Verbose

Can you update the pull request with a new commit?

Seems like this is the commonly used approach (for example log4j: http://en.wikipedia.org/wiki/Log4j).

@nicoyuste
@bpoplauschi
Collaborator

@nicoyuste any updates?

@nicoyuste

Ok! Done!

Now it works this way:
1 - Error
2 - Warning
3 - Info
4 - Debug
5 -Verbose

@rivera-ernesto rivera-ernesto merged commit 8e68787 into CocoaLumberjack:master
@rivera-ernesto
Collaborator

Nice!

@rivera-ernesto rivera-ernesto referenced this pull request from a commit in rivera-ernesto/CocoaLumberjack
@rivera-ernesto rivera-ernesto Add new DEBUG log level support to included loggers
Complements #145.
2869086
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 23 additions and 17 deletions.
  1. +23 −17 Lumberjack/DDLog.h
View
40 Lumberjack/DDLog.h
@@ -205,37 +205,43 @@
* https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomLogLevels
**/
-#define LOG_FLAG_ERROR (1 << 0) // 0...0001
-#define LOG_FLAG_WARN (1 << 1) // 0...0010
-#define LOG_FLAG_INFO (1 << 2) // 0...0100
-#define LOG_FLAG_VERBOSE (1 << 3) // 0...1000
+#define LOG_FLAG_ERROR (1 << 0) // 0...00001
+#define LOG_FLAG_WARN (1 << 1) // 0...00010
+#define LOG_FLAG_INFO (1 << 2) // 0...00100
+#define LOG_FLAG_DEBUG (1 << 3) // 0...01000
+#define LOG_FLAG_VERBOSE (1 << 4) // 0...10000
#define LOG_LEVEL_OFF 0
-#define LOG_LEVEL_ERROR (LOG_FLAG_ERROR) // 0...0001
-#define LOG_LEVEL_WARN (LOG_FLAG_ERROR | LOG_FLAG_WARN) // 0...0011
-#define LOG_LEVEL_INFO (LOG_FLAG_ERROR | LOG_FLAG_WARN | LOG_FLAG_INFO) // 0...0111
-#define LOG_LEVEL_VERBOSE (LOG_FLAG_ERROR | LOG_FLAG_WARN | LOG_FLAG_INFO | LOG_FLAG_VERBOSE) // 0...1111
-
-#define LOG_ERROR (ddLogLevel & LOG_FLAG_ERROR)
-#define LOG_WARN (ddLogLevel & LOG_FLAG_WARN)
-#define LOG_INFO (ddLogLevel & LOG_FLAG_INFO)
-#define LOG_VERBOSE (ddLogLevel & LOG_FLAG_VERBOSE)
+#define LOG_LEVEL_ERROR (LOG_FLAG_ERROR) // 0...00001
+#define LOG_LEVEL_WARN (LOG_FLAG_ERROR | LOG_FLAG_WARN) // 0...00011
+#define LOG_LEVEL_INFO (LOG_FLAG_ERROR | LOG_FLAG_WARN | LOG_FLAG_INFO) // 0...00111
+#define LOG_LEVEL_DEBUG (LOG_FLAG_ERROR | LOG_FLAG_WARN | LOG_FLAG_INFO | LOG_FLAG_DEBUG) // 0...01111
+#define LOG_LEVEL_VERBOSE (LOG_FLAG_ERROR | LOG_FLAG_WARN | LOG_FLAG_INFO | LOG_FLAG_DEBUG | LOG_FLAG_VERBOSE) // 0...11111
+
+#define LOG_ERROR (ddLogLevel & LOG_FLAG_ERROR)
+#define LOG_WARN (ddLogLevel & LOG_FLAG_WARN)
+#define LOG_INFO (ddLogLevel & LOG_FLAG_INFO)
+#define LOG_DEBUG (ddLogLevel & LOG_FLAG_DEBUG)
+#define LOG_VERBOSE (ddLogLevel & LOG_FLAG_VERBOSE)
#define LOG_ASYNC_ENABLED YES
-#define LOG_ASYNC_ERROR ( NO && LOG_ASYNC_ENABLED)
-#define LOG_ASYNC_WARN (YES && LOG_ASYNC_ENABLED)
-#define LOG_ASYNC_INFO (YES && LOG_ASYNC_ENABLED)
-#define LOG_ASYNC_VERBOSE (YES && LOG_ASYNC_ENABLED)
+#define LOG_ASYNC_ERROR ( NO && LOG_ASYNC_ENABLED)
+#define LOG_ASYNC_WARN (YES && LOG_ASYNC_ENABLED)
+#define LOG_ASYNC_INFO (YES && LOG_ASYNC_ENABLED)
+#define LOG_ASYNC_DEBUG (YES && LOG_ASYNC_ENABLED)
+#define LOG_ASYNC_VERBOSE (YES && LOG_ASYNC_ENABLED)
#define DDLogError(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, ddLogLevel, LOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__)
#define DDLogWarn(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_WARN, ddLogLevel, LOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__)
#define DDLogInfo(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_INFO, ddLogLevel, LOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__)
+#define DDLogDebug(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_DEBUG, ddLogLevel, LOG_FLAG_DEBUG, 0, frmt, ##__VA_ARGS__)
#define DDLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, ddLogLevel, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)
#define DDLogCError(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_ERROR, ddLogLevel, LOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__)
#define DDLogCWarn(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_WARN, ddLogLevel, LOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__)
#define DDLogCInfo(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_INFO, ddLogLevel, LOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__)
+#define DDLogCDebug(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_DEBUG, ddLogLevel, LOG_FLAG_DEBUG, 0, frmt, ##__VA_ARGS__)
#define DDLogCVerbose(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_VERBOSE, ddLogLevel, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)
/**
Something went wrong with that request. Please try again.