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
190
スタートアップの急成長に寄り添うOn-Call体制構築とその変遷
horimislime
3
1.6k
How we build our app with minimum 3rd party dependencies
horimislime
0
86
migrating-from-promise-to-reactive
horimislime
0
370
社内Swiftもくもく会成果発表
horimislime
0
120
Swift Optional Extension Tips
horimislime
1
1.5k
ios-internationalization
horimislime
2
8.8k
UI testing in XCode7
horimislime
3
770
UIテストをカジュアルに自動化 / UI Automation using Remote
horimislime
2
2.3k
Other Decks in Technology
See All in Technology
Kotlin Multiplatformのポテンシャル
recruitengineers
PRO
2
150
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!座学①
siyuanzh09
0
110
Godot Engineについて調べてみた
unsoluble_sugar
0
370
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
150
今から、 今だからこそ始める Terraform で Azure 管理 / Managing Azure with Terraform: The Perfect Time to Start
nnstt1
0
200
re:Invent 2024のふりかえり
beli68
0
110
テストを書かないためのテスト/ Tests for not writing tests
sinsoku
1
170
信頼されるためにやったこと、 やらなかったこと。/What we did to be trusted, What we did not do.
bitkey
PRO
0
2.1k
My small contributions - Fujiwara Tech Conference 2025
ijin
0
1.4k
AWSサービスアップデート 2024/12 Part3
nrinetcom
PRO
0
140
Alignment and Autonomy in Cybozu - 300人の開発組織でアラインメントと自律性を両立させるアジャイルな組織運営 / RSGT2025
ama_ch
1
2.3k
Unsafe.BitCast のすゝめ。
nenonaninu
0
190
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
33
2.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Being A Developer After 40
akosma
89
590k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
3
180
Making Projects Easy
brettharned
116
6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
For a Future-Friendly Web
brad_frost
176
9.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
960
A Modern Web Designer's Workflow
chriscoyier
693
190k
Code Review Best Practice
trishagee
65
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
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