Skip to content

Commit

Permalink
Merge pull request #555 from skensell/patch-1
Browse files Browse the repository at this point in the history
Update CustomFormatters.md with proper thread-safe blurb.
  • Loading branch information
bpoplauschi committed Jul 8, 2015
2 parents aa9e74c + 078703f commit d1e1cbe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Documentation/CustomFormatters.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ MyCustomFormatter.m
# Thread-safety (simple)
Let's update our example formatter to also include the timestamp. To do this we'll use `NSDateFormatter`. But... `NSDateFormatter` is NOT thread-safe. Does this pose any problems for us?
Let's update our example formatter to also include the timestamp. To do this we'll use `NSDateFormatter`. But... `NSDateFormatter` is NOT thread-safe (unless you're targeting iOS 7+, or OSX 10.9+ with modern behavior on 64-bit architecture, see [NSDateFormatter](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/])). Does this pose any problems for us?
Log formatters are applied individually to loggers. If you instantiate a log formatter instance, **and apply it to a single logger**, then you don't have to worry about thread-safety. All log messages are sent to the logger (and thus to its log formatter) via the serial dispatch queue of the logger. Thus, in this scenario, the formatLogMessage method is guaranteed to run on only a single thread at a time.
Expand Down

0 comments on commit d1e1cbe

Please sign in to comment.