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
140
スタートアップの急成長に寄り添うOn-Call体制構築とその変遷
horimislime
3
1.5k
How we build our app with minimum 3rd party dependencies
horimislime
0
82
migrating-from-promise-to-reactive
horimislime
0
360
社内Swiftもくもく会成果発表
horimislime
0
110
Swift Optional Extension Tips
horimislime
1
1.4k
ios-internationalization
horimislime
2
8.8k
UI testing in XCode7
horimislime
3
750
UIテストをカジュアルに自動化 / UI Automation using Remote
horimislime
2
2.3k
Other Decks in Technology
See All in Technology
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
380
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
530
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
120
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
5
560
なぜ今 AI Agent なのか _近藤憲児
kenjikondobai
4
1.3k
Can We Measure Developer Productivity?
ewolff
1
150
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
120
元旅行会社の情シス部員が教えるおすすめなre:Inventへの行き方 / What is the most efficient way to re:Invent
naospon
2
330
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
470
VideoMamba: State Space Model for Efficient Video Understanding
chou500
0
190
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Become a Pro
speakerdeck
PRO
25
5k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Docker and Python
trallard
40
3.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
How to Ace a Technical Interview
jacobian
276
23k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
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