Yet another simple logger

Yet another simple logger

88cc995ce5954b15c12ea14904258757?s=128

Kento Nagata

April 19, 2018
Tweet

Transcript

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

    Kento Nagata
  2. ©2018 Wantedly, Inc. Ӭా݈ਓ 8BOUFEMZ *OD&OHJOFFS !OHULOU !OHUL • Wantedly

    VisitͷΞϓϦΛ։ൃ͍ͯ͠·͢ • Swift/iOS։ൃΛ͸͡Ίͯ3ϲ݄͘Β͍ • ΋ͱ΋ͱ͸Railsͱ͔React/Reduxͱ͔΢Σϒͷ։ൃΛ΍͍ͬͯͨਓ • PotatotipsॳࢀՃ&ॳൃද ☺
  3. ©2018 Wantedly, Inc. XcodeͷConsole log׆༻͍ͯ͠·͔͢ʁ

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

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

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

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

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

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

  10. ©2018 Wantedly, Inc. Swiftybeaver

  11. ©2018 Wantedly, Inc. Pros • 3500 Star • ϩάϨϕϧʹରԠ (verbose,

    debug, info, warning, error) • ϑΝΠϧ΍ίϯιʔϧ΁ग़ྗͳͲඪ४Ͱ๛෋ͳग़ྗઌΦϓγϣϯΛ͍࣋ͬͯΔ • ϩάϨϕϧΛϑΟϧλϦϯάͰ͖ΔΞϓϦ͕͋Δ • ඇಉظͰͷग़ྗʹରԠ͍ͯ͠Δ • ϑΥʔϚοτͷઃఆ Swiftbeaver
  12. ©2018 Wantedly, Inc. Cons • ΞϓϦͰจࣈྻΛίϐϖͰ͖ͳ͍ • ༗ྉͷϓϥοτϑΥʔϜ͕͋Γɺྑ͘΋ѱ͘΋ϩοΫΠϯ͞ΕΔՄೳੑ͋Γ • ֓Ͷྑ͍͚ͲɺΠϯλʔϑΣΠε͕ඍົͳͱ͜Ζ͕͋Δ

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

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

    • ֎෦ʹ౤͍͛ͨέʔε͕͋Δ • ϑΝΠϧग़ྗͯ͠֎෦ͰϑΟϧλϦϯά͍ͨ͠ ཉ͔ͬͨ͠΋ͷ
  15. ©2018 Wantedly, Inc. 3. σόοάͱϦϦʔεͰڍಈΛ
 ม͑ΒΕΔΑ͏ʹ͍ͨ͠ • ϦϦʔε΍ςετͰ͸ͳʹ΋͠ͳ͍ͳͲ੾Γସ͍͑ͨ ཉ͔ͬͨ͠΋ͷ

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

  17. ©2018 Wantedly, Inc. LoggerProtocol

  18. ©2018 Wantedly, Inc. LoggerProtocol extension

  19. ©2018 Wantedly, Inc. LogContextProtocol and LogContext

  20. ©2018 Wantedly, Inc. Logger

  21. ©2018 Wantedly, Inc. LogLevel

  22. ©2018 Wantedly, Inc. LogDestinationProtocol and StandardOut

  23. ©2018 Wantedly, Inc. LogFormatterProtocol

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

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

  26. ©2018 Wantedly, Inc. LogDestinationProtocol and StandardOut

  27. ©2018 Wantedly, Inc. logger

  28. ©2018 Wantedly, Inc. Console output

  29. ©2018 Wantedly, Inc. ·ͱΊ

  30. ©2018 Wantedly, Inc. 1. γϯϓϧͰ࢖͑ͦ͏ͳ΋ͷ͕Ͱ͖ͨ 2. ·࣮ͩݱͰ͖͍ͯͳ͍͜ͱ΋͋Δ • ඇಉظͷग़ྗ •

    ϑΟϧλϦϯάͷγΣϧεΫϦϓτ 3. ຊ౰͸SwiftͷΤίγεςϜશମͰ࢖ΘΕΔ΋ͷ
 ͕΄͍͠ʂ ·ͱΊ