update doc from DDLogLevelWarn to DDLogLevelWarning to match library

This commit is contained in:
Ross Bender
2023-10-08 18:09:24 -05:00
committed by Florian Friedrich
parent 590a4b2d10
commit a03e5c4362
3 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -4,7 +4,7 @@ Dynamically changing log levels during run-time
When you define your log level, you generally define it in a manner similar to this: When you define your log level, you generally define it in a manner similar to this:
```objc ```objc
static const DDLogLevel ddLogLevel = DDLogLevelWarn; static const DDLogLevel ddLogLevel = DDLogLevelWarning;
``` ```
What this means is that your log level is declared as a constant. It cannot be changed. What this means is that your log level is declared as a constant. It cannot be changed.
@@ -13,7 +13,7 @@ This has the advantage that the compiler can automatically prune `DDLog` stateme
To allow a dynamic log level, all we need to do is remove the "const" part: To allow a dynamic log level, all we need to do is remove the "const" part:
```objc ```objc
static DDLogLevel ddLogLevel = DDLogLevelWarn; static DDLogLevel ddLogLevel = DDLogLevelWarning;
``` ```
This means that we can change the log level when/how we want. For example, maybe we're debugging some specific part of our application. This means that we can change the log level when/how we want. For example, maybe we're debugging some specific part of our application.
@@ -24,7 +24,7 @@ This means that we can change the log level when/how we want. For example, maybe
} }
- (void)taskDidFinish { - (void)taskDidFinish {
ddLogLevel = DDLogLevelWarn; ddLogLevel = DDLogLevelWarning;
} }
``` ```
@@ -45,7 +45,7 @@ defaults write com.myapp.prefsLogLevel 4
And in your preference pane code, you have something like this: And in your preference pane code, you have something like this:
```objc ```objc
static DDLogLevel ddLogLevel = DDLogLevelWarn; static DDLogLevel ddLogLevel = DDLogLevelWarning;
+ (void)initialize { + (void)initialize {
NSNumber *logLevel = [[NSUserDefaults standardUserDefaults] objectForKey:@"prefsLogLevel"]; NSNumber *logLevel = [[NSUserDefaults standardUserDefaults] objectForKey:@"prefsLogLevel"];
@@ -75,7 +75,7 @@ The lumberjack framework has something called "registered dynamic logging". Here
#import "Sprocket.h" #import "Sprocket.h"
#import "DDLog.h" #import "DDLog.h"
static DDLogLevel ddLogLevel = DDLogLevelWarn; static DDLogLevel ddLogLevel = DDLogLevelWarning;
@implementation Sprocket @implementation Sprocket
+1 -1
View File
@@ -150,7 +150,7 @@ Which log level you choose per NSLog statement depends, of course, on the severi
These tie into the log level just as you would expect These tie into the log level just as you would expect
- If you set the log level to DDLogLevelError, then you will only see Error statements. - If you set the log level to DDLogLevelError, then you will only see Error statements.
- If you set the log level to DDLogLevelWarn, then you will only see Error and Warn statements. - If you set the log level to DDLogLevelWarning, then you will only see Error and Warn statements.
- If you set the log level to DDLogLevelInfo, you'll see Error, Warn and Info statements. - If you set the log level to DDLogLevelInfo, you'll see Error, Warn and Info statements.
- If you set the log level to DDLogLevelDebug, you'll see Error, Warn, Info and Debug statements. - If you set the log level to DDLogLevelDebug, you'll see Error, Warn, Info and Debug statements.
- If you set the log level to DDLogLevelVerbose, you'll see all DDLog statements. - If you set the log level to DDLogLevelVerbose, you'll see all DDLog statements.
+1 -1
View File
@@ -11,7 +11,7 @@ A better solution is using **per-user** log levels:
#elif defined(DEBUG) #elif defined(DEBUG)
static const DDLogLevel ddLogLevel = DDLogLevelInfo; // Log level for other team members (debug) static const DDLogLevel ddLogLevel = DDLogLevelInfo; // Log level for other team members (debug)
#else #else
static const DDLogLevel ddLogLevel = DDLogLevelWarn; // Log level for release build static const DDLogLevel ddLogLevel = DDLogLevelWarning; // Log level for release build
#endif #endif
``` ```