Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Introduction to CocoaLumberjack
Search
Kristian Andersen
February 13, 2014
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction to CocoaLumberjack
Presented at Cocoaheads Copenhagen on 13 Februrary 2014
Kristian Andersen
February 13, 2014
More Decks by Kristian Andersen
See All by Kristian Andersen
Isomorphic Web Apps with React
ksmandersen
0
52
Flexbox all the things
ksmandersen
2
170
Static Websites with Gulp & AWS
ksmandersen
0
140
Practical MVVM
ksmandersen
0
230
Practical Swift
ksmandersen
1
220
Other Decks in Programming
See All in Programming
一人だけ、Kiroが静止する日
hideg
0
110
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
140
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
460
App Intentsのビルドプロセスを支える技術
kntkymt
0
370
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
120
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
490
Jetpack Compose メカニズム
skydoves
0
420
What We Talk About When We Talk About XP
m_seki
2
620
新卒PdEのリアル
ryu1013
1
500
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
320
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
120
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
330
Featured
See All Featured
Are puppies a ranking factor?
jonoalderson
2
3.9k
Amusing Abliteration
ianozsvald
1
300
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
380
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
230
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Designing Experiences People Love
moore
143
24k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Thoughts on Productivity
jonyablonski
76
5.4k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
700
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
Transcript
CocoaLumberjack
Hi! I’m Kristian @ksmandersen
None
None
CocoaLumberjack
Why? • NSLog is inflexible • NSLog is slow •
NSLog has no levels
Performance “[…] I switched out all the logging statements from
using NSLog to use CocoaLumberjacks DDLog instead, and saw an increase in performance of almost 6x […]”
Performance “[…] I switched out all the logging statements from
using NSLog to use CocoaLumberjacks DDLog instead, and saw an increase in performance of almost 6x […]”
Performance 1. Open a new connection to ASL daemon 2.
Send message to ASL daemon 3. Close that connection 4. Write the same message to STDERR 5. for each NSLog statement: GOTO 1;
CocoaLumberjack • Multiple outputs • Different logging levels • Much
faster! • Very flexible
Getting started [DDLog addLogger:[DDTTYLogger sharedInstance]];
LEVELS DDLogError(@"Some error %@, %@", error, error.userInfo); DDLogWarn(@"Unexpected thing"); DDLogInfo(@"Heads
up here"); DDLogDebug(@"Bug bug debug"); DDLogVerbose(@"Extreme verbosity");
Replacing NSLOG // Making NSLog use Cocoa Lumberjack #define NSLog
DDLogInfo
Replacing NSLOG // Making NSLog use Cocoa Lumberjack #define NSLog
DDLogInfo
Colors https://github.com/robbiehanson/XcodeColors
AFNetworking AFNetworkActivityLogger *logger = [AFNetworkActivityLogger sharedLogger]; ! [logger setLevel:AFLoggerLevelInfo]]; [logger
startLogging];
AFNetworking GET http://example.com/foo/bar.json 200 http://example.com/foo/bar.json ! POST http://example.com/other/url.json 503 http://example.com/other/url.json
Crashlytics [DDLog addLogger:[CrashlyticsLogger sharedInstance]];
Formatters DDLogError(@"Paper Jam!"); // E | Paper Jam! DDLogWarn(@"Low toner.");
// W | Low toner. DDLogInfo(@"Doc printed."); // I | Doc printed. DDLogDebug(@"Debugging"); // D | Debugging DDLogVerbose(@"Init doc_parse"); // V | Init doc_parse.
Formatters - (NSString *)formatLogMessage:(DDLogMessage *)logMessage { NSString *logLevel; switch (logMessage->logFlag)
{ case LOG_FLAG_ERROR : logLevel = @"E"; break; case LOG_FLAG_WARN : logLevel = @"W"; break; case LOG_FLAG_INFO : logLevel = @"I"; break; case LOG_FLAG_DEBUG : logLevel = @"D"; break; default : logLevel = @"V"; break; } return [NSString stringWithFormat:@"%@ | %@\n", logLevel, logMessage->logMsg]; }
Per logger levels [DDLog addLogger:[DDTTYLogger sharedInstance] withLogLevel:LOG_LEVEL_INFO];
PER CLASS LEVEL + (NSArray *)registeredClasses; + (NSArray *)registeredClassNames; !
+ (int)logLevelForClass:(Class)aClass; + (int)logLevelForClassWithName:(NSString *)aClassName; ! + (void)setLogLevel:(int)logLevel forClass:(Class)aClass; + (void)setLogLevel:(int)logLevel forClassWithName:(NSString *)aClassName;
App broken w/ no crash
App broken w/ no crash
Rolling Logs DDFileLogger *fileLogger = [[DDFileLogger alloc] init]; ! [fileLogger
setRollingFrequency:60 * 60 * 24]; [fileLogger setMaximumFileSize:1024 * 1024 * 2]; [fileLogger.logFileManager setMaximumNumberOfLogFiles:7]; [DDLog addLogger:fileLogger];
DEMO
Questions? @ksmandersen
jobs.robo.cat