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
サポート効率を上げるためのロギング環境構築
Search
horimislime
September 17, 2017
Technology
7
3.8k
サポート効率を上げるためのロギング環境構築
iOSDC Japan 2017 2017/9/17 (日)
https://iosdc.jp/2017/node/1422
horimislime
September 17, 2017
Tweet
Share
More Decks by horimislime
See All by horimislime
PagerDuty を軸にした On-Call 構築と運用課題の解決 / PagerDuty Japan Community Meetup 4
horimislime
1
170
スタートアップの急成長に寄り添うOn-Call体制構築とその変遷
horimislime
3
1.6k
How we build our app with minimum 3rd party dependencies
horimislime
0
85
migrating-from-promise-to-reactive
horimislime
0
360
社内Swiftもくもく会成果発表
horimislime
0
120
Swift Optional Extension Tips
horimislime
1
1.5k
ios-internationalization
horimislime
2
8.8k
UI testing in XCode7
horimislime
3
760
UIテストをカジュアルに自動化 / UI Automation using Remote
horimislime
2
2.3k
Other Decks in Technology
See All in Technology
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
.NET 9 のパフォーマンス改善
nenonaninu
0
360
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
250
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
180
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
8
3.2k
MLOps の現場から
asei
6
630
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
2
2.1k
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
150
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
270
UI State設計とテスト方針
rmakiyama
2
290
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Agile that works and the tools we love
rasmusluckow
328
21k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
A designer walks into a library…
pauljervisheath
204
24k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
440
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Unsuck your backbone
ammeep
669
57k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Transcript
αϙʔτޮΛ্͛ΔͨΊͷ ϩΪϯάڥߏங 2017/09/17 () ງݟ फҰ @horimislime iOSDC Japan 2017
ࣗݾհ • ງݟ फҰ (@horimislime) • ! גࣜձࣾτϨλ • "
iPad͚ͷ༧ாΞϓϦ։ൃ • # ϞόΠϧΞϓϦͷΤϥʔϩάऩूʹ͍ͭͯ iOSDC Japan 2017
ฐࣾʹ͍ͭͯ • 2013ϩʔϯνɺࠃ8000ళͰಋೖ • ଟݴޠԽͰΞδΞݍʹల։ ! • ࠷ۙBLEΛͬͨϋʔυΣΞ iOSDC Japan
2017
Կ͕ى͖͔ͨ • ࠶ݱੑͷͳ͍ෆ۩߹͍߹Θ͕ͤ • ίϛϡχέʔγϣϯίετͷ૿େ • ϋʔυΣΞབྷΜͰ͞ΒʹෳࡶԽ iOSDC Japan 2017
Ξϓϩʔν 1. ΫϥογϡҎ֎ͷΤϥʔΛݕͰ͖Δମ੍࡞Γ 2. ௐࠪʹඞཁͳώϯτͳΔ͘૿͢ 3. ͍߹Θͤ࣌ͷίετΛݮΒ͢ iOSDC Japan 2017
Ξϓϩʔν 1. ΫϥογϡҎ֎ͷΤϥʔΛݕͰ͖Δମ੍࡞Γ 2. ௐࠪʹඞཁͳώϯτͳΔ͘૿͢ 3. ͍߹Θͤ࣌ͷίετΛݮΒ͢ iOSDC Japan 2017
ฐࣾͷ͜Ε·Ͱ • HockeyAppͰΫϥογϡऩूʢݱʣ • ΫϥογϡใҎ֎ʹϩάϑΝΠϧͷૹ৴ػೳ • ϩάૹ৴ͷλΠϛϯάΫϥογϡ࣌ͷΈ • Ϋϥογϡ࣌ͷใ͕গͳ͍ iOSDC
Japan 2017
Ҡߦܭը • ΫϥογϡҎ֎ͷΤϥʔΛݕͰ͖Δମ੍࡞Γ • ΫϥογϡɾΤϥʔૹ৴࣌ͷঢ়ଶΛৄ͘͠Γ͍ͨ • BugsnagΛ࠾༻͢Δࣄʹ iOSDC Japan 2017
αʔϏεબఆ • େखͩͱ3αʔϏε͕΄΅ಉͷػೳ • • • • ʮύϯͣ͘ϩάʯΛ͑Δͷ͕ศར iOSDC Japan
2017
ύϯͣ͘ϩά • Τϥʔൃੜ·Ͱͷಓ͠Δ • ΞϓϦͷ৭ΜͳॴʹࠐΉ͚ͩ • ΤϥʔͱҰॹʹ࣌ܥྻͰϩάදࣔ func buttonTapped(sender: UIButton)
{ Bugsnag.leaveBreadcrumb("\(sender.title) tapped!") } iOSDC Japan 2017
Logger.swift struct Logger { func info(message: String) { debugPrint(message) Bugsnag.leaveBreadcrumb(message)
} func error(message: String) { debugPrint(message) Bugsnag.notifyError(...) } } iOSDC Japan 2017
࣮iOSඪ४ػೳͱͯ͠ଘࡏ iOSDC Japan 2017
Activity Tracing iOSDC Japan 2017
1. ΫϥογϡҎ֎ͷΤϥʔΛݕͰ͖Δମ੍࡞Γ 2. ௐࠪʹඞཁͳώϯτͳΔ͘૿͢ 3. ͍߹Θͤ࣌ͷίετΛݮΒ͢ iOSDC Japan 2017
1. ΫϥογϡҎ֎ͷΤϥʔΛݕͰ͖Δମ੍࡞Γ 2. ௐࠪʹඞཁͳώϯτͳΔ͘૿͢ 3. ͍߹Θͤ࣌ͷίετΛݮΒ͢ iOSDC Japan 2017
ௐ͕ࠪḿΔใͱ • Ϣʔβ͕Ͳ͏͍ͬͨૢ࡞Λߦ͔ͬͨ • ͕ىͬͨ͜ͷͲ͏͍͏ঢ়ଶɾڥ͔ iOSDC Japan 2017
Ϣʔβͷߦಈϩά • ViewControllerͷભҠϩά • ݩʑHockeyApp͔࣌Βऩू • ύϯͣ͘ʹͦͷ··ೖΕΔΑ͏ʹ iOSDC Japan 2017
UIͷૢ࡞ཤྺ • UITextFieldͷϑΥʔΧεɾUIButtonͷλοϓ • AnalyticsͰर͍ͬͯΔΠϕϯτͱॏෳ͢Δ͕ • accessibilityIdentifierΛૹ࣮ͬͯΛ࠷খʹ iOSDC Japan 2017
Ϣʔβͷঢ়ଶ • ࠷ۙͷαʔϏεࣗಈऩू • Bugsnag΄ͱΜͲͷঢ়ଶΛऩू iOSDC Japan 2017
ωοτϫʔΫଓঢ়گ • ReachabilityͷΠϕϯτΛߪಡ • ࣮"ϧʔλʹܨ͕͍ͬͯΔ͔"͔͠ அ͕͔ͭͳ͍ • Πϯλʔωοτʹग़ΒΕͳ͍߹ iOSDC Japan
2017
ͦͷଞͷίϯιʔϧϩά • γεςϜ͕ు͖ग़ͯ͠Δϩά (AutoLayout่ΕͳͲ) • ϩάอଘઌΛҙͷσΟϨΫτϦԼʹมߋͰ͖Δ • Ϋϥογϡʹhookͯ͠ϑΝΠϧͷதΛૹ৴͢Δ͜ͱՄೳ var paths
= NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) let directory = paths[0] let logFilePath = (directory as NSString).appendingPathComponent("\(Date()).log") freopen(logFilePath.cString(using: String.Encoding.ascii)!, "a+", stderr) iOSDC Japan 2017
1. ΫϥογϡҎ֎ͷΤϥʔΛݕͰ͖Δମ੍࡞Γ 2. ௐࠪʹඞཁͳώϯτͳΔ͘૿͢ 3. ͍߹Θͤ࣌ͷίετΛݮΒ͢ iOSDC Japan 2017
1. ΫϥογϡҎ֎ͷΤϥʔΛݕͰ͖Δମ੍࡞Γ 2. ௐࠪʹඞཁͳώϯτͳΔ͘૿͢ 3. ͍߹Θͤ࣌ͷίετΛݮΒ͢ iOSDC Japan 2017
͍߹Θͤ࣌ͷίετͳͥ૿͑Δ͔ • ௐࠪʹඞཁͳϩά͕ͦͦݟΕͳ͍ • ຊޠͰత֬ʹୡ͢Δͷ͕͍͠ iOSDC Japan 2017
struct Service { func connectToDevice(completion: Result<Response, NSError>) { // ॲཧ
if notReady { completion(.failure(NSError(domain: "in.toreta", code: 0, userInfo: nil))) } else { completion(.success(response)) } } } override func viewDidLoad() { super.viewDidLoad() service.connectToDevice { result in switch result { case .success(let data): ... case .failure(let _): HUD.show("Τϥʔ͕ൃੜ͠·ͨ͠ɻଓڥΛ֬ೝ͍ͩ͘͞ɻ") } } } iOSDC Japan 2017
ϩδοΫΤϥʔৄࡉʹྻڍ enum ApplicationError: Error { case bleNotAvailable case hardwareNotReady ...
} struct Service { func connectToDevice(completion: Result<Response, ApplicationError>) { // ॲཧ if notReady { completion(.failure(.hardwareNotReady)) } else { completion(.success(response)) } } } iOSDC Japan 2017
Error Code • Ϣʔβ͔Βͷ͍߹ΘͤΛޮԽ͢Δཁ • ώΞϦϯάࣄ߲͔ΒݪҼಛఆ·ͰΛ݁ͤ͞Δ iOSDC Japan 2017
iOSDC Japan 2017
iOSDC Japan 2017
enum ApplicationError: Error { ... case hardwareNotReady var errorCode: Int
{ switch self { ... case hardwareNotReady: return -3000 } } var localizedDescription: String { ... case hardwareNotReady: return "Τϥʔίʔυ: \(errorCode)" } var localizedFailureReason: String { ... case hardwareNotReady: return "ଓʹࣦഊ͠·ͨ͠ɻBLEσόΠεͷిݯΛ֬͝ೝ͍ͩ͘͞ɻ" } } iOSDC Japan 2017
Error Codeͷར1 • ͍߹ΘͤͷແݴޠԽʹܨ͕Δ override func viewDidLoad() { ... service.connectToDevice
{ result in switch result { case .success(let data): ... case .failure(let error): Logger.shared.error(error) self.showAlert(withTitle: error.localizedDescription, message: error.localizedFailureReason) } } } iOSDC Japan 2017
Error Codeͷར2 • ϩάૹ৴͓͖ͯ͠ௐࠪΛޮԽ • ͍߹ΘͤΛݩʹDashboardͰҰൃ ݕࡧ iOSDC Japan 2017
ϙΠϯτ • ΤϥʔίʔυΞϓϦଆͰҰׅఆٛɾཧ͢Δͱྑͦ͞͏ • localizedFailureReasonͳͲSDK͕ฦ͢ͷΛΘͳ͍ • 3rd party FWͰnilΛฦͯ͠Δ͜ͱ͕ී௨ʹ͋Δ iOSDC
Japan 2017
1. ΫϥογϡҎ֎ͷΤϥʔΛݕͰ͖Δମ੍࡞Γ 2. ௐࠪʹඞཁͳώϯτͳΔ͘૿͢ 3. ͍߹Θͤ࣌ͷίετΛݮΒ͢ iOSDC Japan 2017
·ͱΊ • ෆ۩߹͕ൃੜ͢Δͱଟ͘ͷਓʹίετ͕͔͔Δ • ؆୯ͳ࡞ۀͰେ͖ͳϝϦοτ • ແବͳΓͱΓΛݮΒ͠շదͳτϥϒϧγϡʔςΟϯάΛ iOSDC Japan 2017