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
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
1k
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
950
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
140
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
180
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
心が動くエンジニアリング ── 私が夢中になる理由
16bitidol
0
100
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
日経電子版のStoreKit2フルリニューアル
shimastripe
1
140
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
0
210
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
We Have a Design System, Now What?
morganepeng
50
7.2k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Facilitating Awesome Meetings
lara
50
6.1k
Side Projects
sachag
452
42k
Writing Fast Ruby
sferik
627
61k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
What's new in Ruby 2.0
geeforr
343
31k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
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