Slide 1

Slide 1 text

©2018 Wantedly, Inc. Yet another simple logger 19.Apr.2018 - @ngtk, Kento Nagata

Slide 2

Slide 2 text

©2018 Wantedly, Inc. Ӭా݈ਓ 8BOUFEMZ *OD&OHJOFFS !OHULOU !OHUL • Wantedly VisitͷΞϓϦΛ։ൃ͍ͯ͠·͢ • Swift/iOS։ൃΛ͸͡Ίͯ3ϲ݄͘Β͍ • ΋ͱ΋ͱ͸Railsͱ͔React/Reduxͱ͔΢Σϒͷ։ൃΛ΍͍ͬͯͨਓ • PotatotipsॳࢀՃ&ॳൃද ☺

Slide 3

Slide 3 text

©2018 Wantedly, Inc. XcodeͷConsole log׆༻͍ͯ͠·͔͢ʁ

Slide 4

Slide 4 text

©2018 Wantedly, Inc. ͳΔ΂͘σόοΨʔΛ࢖Θͣʹ
 ؆୯ʹ໰୊Λղܾ͍ͨ͠

Slide 5

Slide 5 text

©2018 Wantedly, Inc. => ϩάΛ׆༻͢Δ

Slide 6

Slide 6 text

©2018 Wantedly, Inc. ͨͩɺݱঢ়ͷϩάػߏ͸ෆຬ͕͋Γ·ͨ͠

Slide 7

Slide 7 text

©2018 Wantedly, Inc. 1. SwiftͰ͸print͔͠ͳ͍ͨΊɺ
 ϥΠϒϥϦͷඪ४ग़ྗ͸ίϯτϩʔϧෆՄೳ 2. ϩάϨϕϧ͕ͳ͍ͨΊɺ
 ͱΓ͋͑ͣprintͰݟͮΒ͘ͳͬͯ͘Δ ϩάػߏ΁ͷෆຬ

Slide 8

Slide 8 text

©2018 Wantedly, Inc. ϥΠϒϥϦͰղܾ͢Δʁ

Slide 9

Slide 9 text

©2018 Wantedly, Inc. ϩΪϯάͷϥΠϒϥϦ͸
 ͍͔ͭ͋͘Γ·͢

Slide 10

Slide 10 text

©2018 Wantedly, Inc. Swiftybeaver

Slide 11

Slide 11 text

©2018 Wantedly, Inc. Pros • 3500 Star • ϩάϨϕϧʹରԠ (verbose, debug, info, warning, error) • ϑΝΠϧ΍ίϯιʔϧ΁ग़ྗͳͲඪ४Ͱ๛෋ͳग़ྗઌΦϓγϣϯΛ͍࣋ͬͯΔ • ϩάϨϕϧΛϑΟϧλϦϯάͰ͖ΔΞϓϦ͕͋Δ • ඇಉظͰͷग़ྗʹରԠ͍ͯ͠Δ • ϑΥʔϚοτͷઃఆ Swiftbeaver

Slide 12

Slide 12 text

©2018 Wantedly, Inc. Cons • ΞϓϦͰจࣈྻΛίϐϖͰ͖ͳ͍ • ༗ྉͷϓϥοτϑΥʔϜ͕͋Γɺྑ͘΋ѱ͘΋ϩοΫΠϯ͞ΕΔՄೳੑ͋Γ • ֓Ͷྑ͍͚ͲɺΠϯλʔϑΣΠε͕ඍົͳͱ͜Ζ͕͋Δ Swiftbeaver

Slide 13

Slide 13 text

©2018 Wantedly, Inc. ཉ͔ͬͨ͠΋ͷΛ੔ཧ͢Δ

Slide 14

Slide 14 text

©2018 Wantedly, Inc. 1. ৘ใͷ༏ઌ౓΍ҙຯ෇͚Λ͢ΔͨΊɺ
 ϩάϨϕϧ͕΄͍͠ • ඞཁʹԠͯ͡ϑΟϧλϦϯάͯ͠ɺඞཁͳ৘ใʹ؆୯ʹΞΫηε͍ͨ͠ 2. ग़ྗઌΛมߋՄೳʹ͍ͨ͠ • ֎෦ʹ౤͍͛ͨέʔε͕͋Δ • ϑΝΠϧग़ྗͯ͠֎෦ͰϑΟϧλϦϯά͍ͨ͠ ཉ͔ͬͨ͠΋ͷ

Slide 15

Slide 15 text

©2018 Wantedly, Inc. 3. σόοάͱϦϦʔεͰڍಈΛ
 ม͑ΒΕΔΑ͏ʹ͍ͨ͠ • ϦϦʔε΍ςετͰ͸ͳʹ΋͠ͳ͍ͳͲ੾Γସ͍͑ͨ ཉ͔ͬͨ͠΋ͷ

Slide 16

Slide 16 text

©2018 Wantedly, Inc. ͜Ε͘Β͍ͩͬͨΒ
 ࣗ෼Ͱ͔͚Δ͔΋ʁ

Slide 17

Slide 17 text

©2018 Wantedly, Inc. LoggerProtocol

Slide 18

Slide 18 text

©2018 Wantedly, Inc. LoggerProtocol extension

Slide 19

Slide 19 text

©2018 Wantedly, Inc. LogContextProtocol and LogContext

Slide 20

Slide 20 text

©2018 Wantedly, Inc. Logger

Slide 21

Slide 21 text

©2018 Wantedly, Inc. LogLevel

Slide 22

Slide 22 text

©2018 Wantedly, Inc. LogDestinationProtocol and StandardOut

Slide 23

Slide 23 text

©2018 Wantedly, Inc. LogFormatterProtocol

Slide 24

Slide 24 text

©2018 Wantedly, Inc. ͜͜·Ͱ͕ϥΠϒϥϦίʔυ

Slide 25

Slide 25 text

©2018 Wantedly, Inc. ϓϩμΫτίʔυͰ͸
 ग़ྗઌͱϑΥʔϚολʔΛࢦఆ͢Δ

Slide 26

Slide 26 text

©2018 Wantedly, Inc. LogDestinationProtocol and StandardOut

Slide 27

Slide 27 text

©2018 Wantedly, Inc. logger

Slide 28

Slide 28 text

©2018 Wantedly, Inc. Console output

Slide 29

Slide 29 text

©2018 Wantedly, Inc. ·ͱΊ

Slide 30

Slide 30 text

©2018 Wantedly, Inc. 1. γϯϓϧͰ࢖͑ͦ͏ͳ΋ͷ͕Ͱ͖ͨ 2. ·࣮ͩݱͰ͖͍ͯͳ͍͜ͱ΋͋Δ • ඇಉظͷग़ྗ • ϑΟϧλϦϯάͷγΣϧεΫϦϓτ 3. ຊ౰͸SwiftͷΤίγεςϜશମͰ࢖ΘΕΔ΋ͷ
 ͕΄͍͠ʂ ·ͱΊ