Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Unified Logging
Search
Jelle Vandebeeck
December 21, 2018
Technology
0
1.7k
Unified Logging
Jelle Vandebeeck
December 21, 2018
Tweet
Share
More Decks by Jelle Vandebeeck
See All by Jelle Vandebeeck
RubyMotion
fousa
1
92
Git
fousa
1
140
Heroku
fousa
0
140
Cappuccino
fousa
0
120
Other Decks in Technology
See All in Technology
allow_retry と Arel.sql / allow_retry and Arel.sql
euglena1215
1
160
実践!カスタムインストラクション&スラッシュコマンド
puku0x
0
360
Aurora DSQLはサーバーレスアーキテクチャの常識を変えるのか
iwatatomoya
1
880
Function Body Macros で、SwiftUI の View に Accessibility Identifier を自動付与する/Function Body Macros: Autogenerate accessibility identifiers for SwiftUI Views
miichan
2
180
Evolución del razonamiento matemático de GPT-4.1 a GPT-5 - Data Aventura Summit 2025 & VSCode DevDays
lauchacarro
0
170
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
8.7k
COVESA VSSによる車両データモデルの標準化とAWS IoT FleetWiseの活用
osawa
1
270
CDK CLIで使ってたあの機能、CDK Toolkit Libraryではどうやるの?
smt7174
4
130
なぜスクラムはこうなったのか?歴史が教えてくれたこと/Shall we explore the roots of Scrum
sanogemaru
5
1.6k
JTCにおける内製×スクラム開発への挑戦〜内製化率95%達成の舞台裏/JTC's challenge of in-house development with Scrum
aeonpeople
0
210
「全員プロダクトマネージャー」を実現する、Cursorによる仕様検討の自動運転
applism118
21
9.9k
5分でカオスエンジニアリングを分かった気になろう
pandayumi
0
220
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
The Pragmatic Product Professional
lauravandoore
36
6.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
KATA
mclloyd
32
14k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Gamification - CAS2011
davidbonilla
81
5.4k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Building an army of robots
kneath
306
46k
For a Future-Friendly Web
brad_frost
180
9.9k
Context Engineering - Making Every Token Count
addyosmani
1
36
Transcript
UNIFIED LOGGING JELLE VANDEBEECK / ICAPPS 1
Why? ๏ Improved debugging during development ๏ Track down crashes
in asynchronous code ๏ Improved privacy JELLE VANDEBEECK / ICAPPS 2
Legacy NSLog(@"Hello!") asl_log_message syslog JELLE VANDEBEECK / ICAPPS 3
Legacy ๏ Visible in Xcode ๏ Visible in the Console.app
application JELLE VANDEBEECK / ICAPPS 4
Swift print("Hello!") ๏ Visible in Xcode ๏ Not visible in
the Console.app application JELLE VANDEBEECK / ICAPPS 5
New API Exists since iOS 10... ! JELLE VANDEBEECK /
ICAPPS 6
os_log import os os_log(.debug, "Hello") os_log(.info, "Hello") os_log(.default, "Hello") os_log(.error,
"Hello") os_log(.fault, "Hello") JELLE VANDEBEECK / ICAPPS 7
Logging Levels Level Enabled Initially stored On bu!er full Debug
! ! ! Info ✅ Memory ! 1 Default ✅ Memory Disk Error ✅ Disk Disk Fault ✅ Disk Disk 1 Except when an error occurs JELLE VANDEBEECK / ICAPPS 8
To disk ๏ You can find a .tracev3 file that
contains the logs inside of /var/db/diagnostics. ๏ Data stores instead of text-based files. ๏ When date storage is exceeded oldest messages are purged JELLE VANDEBEECK / ICAPPS 9
Usage ๏ Level: Debug ๏ High volume debugging during development
๏ Console.app: ⚫ JELLE VANDEBEECK / ICAPPS 10
Usage ๏ Level: Info ๏ Additional info that will be
captured during an error or faultent ๏ Console.app: ⚪ JELLE VANDEBEECK / ICAPPS 11
Usage ๏ Level: Default ๏ Log critical details to help
debug issues ๏ Console.app: N/A JELLE VANDEBEECK / ICAPPS 12
Usage ๏ Level: Error ๏ Additional information capture from the
app ๏ Console.app: ! JELLE VANDEBEECK / ICAPPS 13
Usage ๏ Level: Fault ๏ Additional information capture from the
system ๏ Console.app: ! JELLE VANDEBEECK / ICAPPS 14
Subsystem & Category let logger = OSLog(subsystem: "com.icapps.logging", category: "Monkey")
os_log("Hello ! ", log: logger) JELLE VANDEBEECK / ICAPPS 15
Privacy ๏ Prevents accidental leak of Personally Identifiable Information ๏
Replaces dynamic strings, collections, arrays with a <private> keyword JELLE VANDEBEECK / ICAPPS 16
Privacy ๏ Primitive types are public by default, but can
be made private with the <public> keyword JELLE VANDEBEECK / ICAPPS 17
Privacy let name: String = "Jake" os_log("Hi \(name)") // !
os_log("Hi %@", name) // Hi <private> os_log("Hi %{public}@", name) // Hi Jake os_log("Hi %{private}d", someNumber) // Hi <private> JELLE VANDEBEECK / ICAPPS 18
Formatters os_log("Time: %{time_t}d", timeInterval) // 2016-01-12 19:41:37 os_log("UUID: %{uuid_t}.16P", uuid)
// 2F6B8A25-A539-4320-A416-83649B8D50BC os_log("IPv4: %{network:in_addr}.16P", address) // 17.43.23.87 JELLE VANDEBEECK / ICAPPS 19
DEMO ! JELLE VANDEBEECK / ICAPPS 20
Overview ๏ Automatic formatting ๏ Automatic collecting file / function
/ line information ๏ Huge performance improvement compared to NSLog JELLE VANDEBEECK / ICAPPS 21
Overview ๏ Improved security ๏ Improved filtertering in the Console.app
JELLE VANDEBEECK / ICAPPS 22
Best practices ๏ Keep the logs compact ๏ Use the
formatters provided by Apple ๏ Don't wrap os_log in other functions ๏ Avoid dictionaries or arrays JELLE VANDEBEECK / ICAPPS 23
Activities JELLE VANDEBEECK / ICAPPS 24
Activities ๏ What happens in async code ๏ Track down
crashes ๏ Shows a clean trace in the Console.app JELLE VANDEBEECK / ICAPPS 25
Activities os_activity_create(...) ๏ Creates an activity ๏ Can be added
to the current activity with OS_ACTIVITY_CURRENT JELLE VANDEBEECK / ICAPPS 26
Scope if(...) { os_activity_scope(...) os_log(...) } JELLE VANDEBEECK / ICAPPS
27
Apply os_activity_apply(activity, ^{ os_log(...) }) JELLE VANDEBEECK / ICAPPS 28
Activity in Swift Should be bridged from Obj-C 2 !
2 Luckely someone create a wrapper that can easily be used in Swift JELLE VANDEBEECK / ICAPPS 29
DEMO ! JELLE VANDEBEECK / ICAPPS 30
References ๏ WWDC 2016 Session ๏ Bridged Activity Gist ๏
Unified Logging and Activity Tracing ๏ Activity Tracing JELLE VANDEBEECK / ICAPPS 31