Everything You Wanted to Know About Logging

Everything You Wanted to Know About Logging

In software the act of logging is like breathing: you simply cannot avoid it. It is also (like one's own breathing patterns) quixotically nuanced. The expressions of this nuance can be seen in the number of ways it is used: in production server programs, in CLI tools, in web browsers, in native Mobile apps, just to name a few.

Winston is the most popular logging library for node. Released in early 2011, it is almost old as node itself. Over time there have been many other libraries that co-exist in the logging space: bunyan, bole, & pino. Yet the popularity of winston persists with over 6.5M monthly downloads and over 200 community contributed packages.

This talk will explore winston@3 and contrast it with other logging solutions that exist today. Not just from the perspective of performance, but from the perspective of flexibility across platforms.

D43e8ea63b61e7669ded5b9d3c2e980f?s=128

Charlie Robbins

October 04, 2017
Tweet

Transcript

  1. None
  2. TO KNOW EVERYTHING YOU WANTED ABOUT LOGGING

  3. WHY, HELLO THERE CHARLIE HERE

  4. WELCOME TO LOGGING. I WILL BE YOUR GUIDE

  5. SENIOR DIR. UX PLATFORM @ (0%"%%: @INDEXZERO GITHUB TWITTER WELCOME

    TO LOGGING. I WILL BE YOUR GUIDE
  6. WINSTON FOR NODE@4 MODERNIZING An EXercise in Open source, STREAMS,

    ES6, And KEEPING CODE ALIVE.
  7. TL;DR?

  8. TL;DR? LOOKING FOR THE TL;DR?

  9. WINSTON IS FROM 2010

  10. WINSTON IS FROM 2010 ACTUALLY JANUARY, 17 2011 BUT STARTED

    IN 2010
  11. None
  12. ...BACK THEN ...

  13. ...BACK THEN ... THINGS WERE A LITTLE DIFFERENT

  14. NEVER BEEN ONE OF THESE 2011 BE LIKE…

  15. NO STREAMS API 2011 BE LIKE…

  16. ES5 IS STILL NEW 2011 BE LIKE…

  17. None
  18. LIMITED CODE COVERAGE TOOLS 2011 BE LIKE…

  19. None
  20. NOT ALL THAT BAD THO

  21. BACK TO THE FUTURE

  22. BACK TO THE FUTURE BY 2015 THINGS WERE MOVING ALONG…

  23. None
  24. WINSTON@1.0.0 SMALL BREAKS

  25. None
  26. WINSTON@2.0.0 BIGGER BREAKS

  27. None
  28. WINSTON@3.0.0  BREAK TO NEW APIS

  29.  OPEN SOURCE

  30.  OPEN SOURCE IT CAN BE DONE!

  31. in 2015 WINSTON HAD ABOUT 2.6 MILLION MONTHLY DOWNLOADS BUNYAN:

    ~0.56M
  32. Open Source is what happens when you’re 
 busy making

    other plans - IF JOHN LENNON WROTE SOFTWARE
  33. None
  34. FAST FORWARD TO 2017

  35. 2017 Downloads 2017 download comparison

  36. 2017 Downloads 2017 download comparison winston continues to “win”

  37. None
  38. BUT JUST WHY EXACTLY?

  39. CONSIDER THE API

  40.  SHAKESPEARE’S “LOGGING”

  41.  SHAKESPEARE’S “LOGGING”  A PLAY IN 5 ACTS

  42. ACT ONE Levels

  43. ACT ONE Levels WHERE IN RFC5424 EMERGES VICTORIOUS IN THE

    END. ALWAYS.
  44. ACT ONE Levels WHERE IN RFC5424 EMERGES VICTORIOUS IN THE

    END. ALWAYS.
  45. ACT TWO Log Shipping

  46. ACT TWO Log Shipping WINSTON TRANSPORTS BUNYAN STREAMS LOG4JS-NODE APPENDERS

  47. STREAMS ALL THE THINGS

  48. STREAMS ALL THE THINGS  In winston@3 a “transport” is

     simply nothing more than a  Node.js WritableStream
  49. ACT THREE Querying & Streaming

  50. ACT THREE Querying & Streaming KIBANA. OR SOME SASS YOU

    PAY FOR. BESPOKE ENDS TRAGICALLY – USUALLY.
  51. ACT FOUR Serialization & Filtering

  52. ACT FOUR Serialization & Filtering JSON, COLORING, PRETTYPRINTING, ALIGNMENT, CUSTOM

    FORMATTING, TIMESTAMPS & SO SO MUCH MORE
  53. ACT FIVE Defaults & Mutation

  54. ACT FIVE Defaults & Mutation BUNYAN SERIALIZERS MORGAN TOKENS LOG4JS-NODE

    PATTERNS
  55. None
  56. OPTIONS HELL IS

  57. OPTIONS HELL IS AT LEAST THE FIFTH CIRCLE OF PROGRAMMING

    HELL
  58. None
  59. COMMON.LOG

  60. COMMON.LOG

  61. COMMON.LOG

  62. COMMON.LOG

  63. COMMON.LOG  THIS IS OPTIONS HELL

  64. INTRODUCE FORMATS

  65. INTRODUCE FORMATS

  66. INTRODUCE FORMATS

  67. INTRODUCE FORMATS

  68. INTRODUCE FORMATS A LA CARTE. PAY FOR WHAT YOU USE.

  69. None
  70. ON PERFORMANCE AND API DESIGN

  71. None
  72. IT TURNS OUT

  73. IT TURNS OUT PERFORMANCE IS SIMPLY NOT EVERYTHING

  74. None
  75. WANT THE DEVELOPERS THE HOMER CAR

  76. None
  77. FORMATS YOUR OWN DEFINE

  78. FORMATS YOUR OWN DEFINE

  79. FORMATS YOUR OWN DEFINE

  80. FORMATS YOUR OWN DEFINE

  81. EASY AS IT LOOKS NOT AS

  82. None
  83. ES6 SYMBOLS

  84. ES6 SYMBOLS SYMBOLS! EVERYWHERE

  85. ES6 SYMBOLS

  86. ES6 SYMBOLS LESS MEMORY OVERHEAD NON-ENUMERABLE / SEMI-PRIVATE WILL NOT

    APPEAR IN DEFAULT JSON.STRINGIFY
  87. None
  88. BACK TO HELL!

  89. BACK TO HELL! COUPLING IS 
 THE NINTH CIRCLE OF

    PROGRAMMING HELL
  90. None
  91. DECOUPLED SHARED FUNCTIONALITY

  92. DECOUPLED SHARED FUNCTIONALITY  require(‘winston-transport’);  require(‘abstract-winston-transport’);

  93. DECOUPLED SHARED FUNCTIONALITY  require(‘winston-transport’);  require(‘abstract-winston-transport’);

  94. DECOUPLED SHARED FUNCTIONALITY  require(‘winston-transport’);  require(‘abstract-winston-transport’);  require(‘logform’)

  95. BACKWARDS COMPATABILITY

  96. BACKWARDS COMPATABILITY  require(‘winston-compat’);  common.log winston.transports.Transport Old vows-based test

    macros
  97.  BENCHMARKS SAY UP TO…

  98. 375% FASTER THAN WINSTON@2  BENCHMARKS SAY UP TO… FASTER

    THAN BUNYAN
  99. None
  100. NEW MAINTAINERS ACTIVELY SEEKING

  101. NEW MAINTAINERS ACTIVELY SEEKING  YES! THAT MEANS YOU! SHOULD

    JOIN WINSTON
  102. FIN  npm install winston@next