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
NilAway による静的解析で「10 億ドル」を節約する #kyotogo / Kyoto Go 56th
ytaka23
3
380
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
220
kargoの魅力について伝える
magisystem0408
0
210
開発生産性向上! 育成を「改善」と捉えるエンジニア育成戦略
shoota
2
390
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
490
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
190
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
200
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
310
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
110
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
270
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
137
6.7k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Fireside Chat
paigeccino
34
3.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Optimising Largest Contentful Paint
csswizardry
33
3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Optimizing for Happiness
mojombo
376
70k
Mobile First: as difficult as doing things right
swwweet
222
9k
The Cult of Friendly URLs
andyhume
78
6.1k
Facilitating Awesome Meetings
lara
50
6.1k
How to Ace a Technical Interview
jacobian
276
23k
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