superlogger 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +42 -50
  3. data/lib/superlogger.rb +44 -19
  4. data/lib/superlogger/action_controller_log_subscriber.rb +5 -14
  5. data/lib/superlogger/action_view_log_subscriber.rb +1 -1
  6. data/lib/superlogger/active_record_log_subscriber.rb +5 -3
  7. data/lib/superlogger/logger.rb +29 -60
  8. data/lib/superlogger/superlogger_middleware.rb +47 -0
  9. data/lib/superlogger/version.rb +1 -1
  10. data/test/dummy/app/assets/config/manifest.js +3 -0
  11. data/test/dummy/config/application.rb +4 -2
  12. data/test/dummy/db/development.sqlite3 +0 -0
  13. data/test/dummy/db/test.sqlite3 +0 -0
  14. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/0R/0RGmr4z2PoNrXTofNEJ55Wrv_v-N3HOrmSgU5ILkXTw.cache +1 -0
  15. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/0W/0W5MOuazdWJMvIog5vEAQfl3ZJiz8KFyVLyNiZ2Tp1I.cache +0 -0
  16. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/2T/2T69JIvG7bvXlqaEFz4SAmmQOu5KcDL3S7O0745_gVc.cache +0 -0
  17. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/2k/2k-V7fw5kQxgx8rJcOMPyJDQ4JbisbnfZQoC2TqHp78.cache +0 -0
  18. data/test/dummy/tmp/cache/assets/sprockets/{v3.0/7J/7JXLU3kClrFYffhxcnNaLGjYz8LFI700NBjNiBOifaU.cache → v4.0.0/2l/2leDpqGCN2J9vjiI1IHvVMlK22cXy2F4hknNF3jqmkg.cache} +0 -0
  19. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/4T/4TXTXXyWGjYW5FUpWGY5b1ecc_ASKWAmht53-rfZ3f4.cache +0 -0
  20. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
  21. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/A-/A-o1cjWqvf_esvFcsIdNZYiYRAbfoTl6xWZoBdtvvsU.cache +0 -0
  22. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/AL/ALcoKZSxe_5jgiHJ70icJlBPAscxfFhRmVLKCKPFHrc.cache +0 -0
  23. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/CK/CKmWm-PGWv8LhwLfTt-8iccYQtEKrPkNNoK21YhKq8M.cache +1 -0
  24. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/DN/DNx8QhxaypFYkrRxHa0ASOI5Re2lXRbN9rGK77jX7K0.cache +0 -0
  25. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/DS/DSOLSc6A5RVSmvM415eEWAWG_AgOvZcLZOXQjsXyWQA.cache +2 -0
  26. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Dh/DhrpoAlYO43_xJT7cR7N5n3Gxc9T9lAEkJkux4ufwrc.cache +1 -0
  27. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Do/DO9Ss2TWmmIJ98nseuLX1kY8yXnC3rfw7qPbjcIiyIg.cache +0 -0
  28. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Do/Do83AoOat5W-c1g7piDGy2GMmffsY6JY0Qfuh5PY3GM.cache +0 -0
  29. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/GP/GPU7T8ibZQ9TVUeUKytpkmqoMwPEDhozvdIulY_ghQc.cache +1 -0
  30. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Hm/HmZiOch1q-Y-bWc2Bg4CkHs0WouAlAVwELLnUki2URU.cache +1 -0
  31. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/M6/M64-PqNj7ipUe_WWRewKavcFikbdVLpvtbkzo5KfCtg.cache +1 -0
  32. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/NX/NXtwZOKZ7yMMJA2FnKYowCStq4BXaQgukCAycF23R4Q.cache +1 -0
  33. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
  34. data/test/dummy/tmp/cache/assets/sprockets/{v3.0/g3/g3x0V2jnf5A31QMz4xGeQMouu2eChQRpoe0BEWWESeY.cache → v4.0.0/Pu/Puw-QRmCoV436fSHMZZyBpIn_ZTQoicwVTISlz3vQoQ.cache} +0 -0
  35. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Rw/RwX76wVv_k976ST-OhQyd6E8Fgi2kfLW6yDFSdnCKA0.cache +0 -0
  36. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/SR/SRlBuVekx5voijkM7Pur-7CEeD9aOoItZYTK7KkxrPc.cache +2 -0
  37. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/TG/TGTts-z_YI7jHUT1N8DOBGdHJLrIKmH_X-sgt638nU4.cache +0 -0
  38. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/XX/XXb_KYmRcMmdP6iwA-m5TK3mNwd-sAWuIDU2BwYh8ys.cache +0 -0
  39. data/test/dummy/tmp/cache/assets/sprockets/{v3.0/br/brSVWTme0G1yzUMjrDpklxoQetdFLXdF8ZUkYXFX-sE.cache → v4.0.0/YB/YBDUr0r2s3vM4McoPLgA6pwj6jYXTvANXBCQr79bS3U.cache} +0 -0
  40. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/Yu/YuxSXQJiI3M2WF3HcV2F-X-X6v0aqPZ87jaK3NIJpBQ.cache +1 -0
  41. data/test/dummy/tmp/cache/assets/sprockets/{v3.0/rg/rghMLGUpm1Uy3OPgfILHnVwLCycV9Rd9kSpEbxdwVV4.cache → v4.0.0/aK/aKG1BE9i1nkV7pxwlTB5hccxO_vqSnmj2oxeB-VW1zY.cache} +0 -0
  42. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/bB/bBXVQV2jOiSWOwtiOr55XUT7RCVlSA-htXqhCHd166k.cache +1 -0
  43. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/bv/bvWA2msm_wKe-upUjI2eMf_Eqi7QlqXZ6M0_TsXEn4E.cache +1 -0
  44. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/cV/cV6tr7nK4y6dNjxzPIKLUszmCcCbY6g48N5ypr-cf78.cache +0 -0
  45. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/cq/cqYKlDsPOsR-Hutsi1Ia2tXUuzOfzbVLP4i9Aonwckk.cache +0 -0
  46. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/dp/dpSU2IktVAqqMTj5iCA6Xg9aVjhNwuhNX987AAPo4Ss.cache +1 -0
  47. data/test/dummy/tmp/cache/assets/sprockets/{v3.0/Gy/Gyqn3Ja6WbUSqKnvWm9Xw7FIxFqJIPQ88IlgpguMo1s.cache → v4.0.0/ec/ecGOPxDOC-PTR8Q87Zu7XU3BS3ueVqHZihjkgAL1GSI.cache} +0 -0
  48. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gC/gCdMfTV-UrcBy2q1SovEwzaag5CwB0k_eFIstyv4gLk.cache +0 -0
  49. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/gZ/gZp3uXMHuYQC4hzCr7bQfetKNdJAtbQmg3so2KpW1Dw.cache +2 -0
  50. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/hF/hFSTd38enn2Za93gw3GzWrAZwHeNX0pUJPH7EiRpNn4.cache +1 -0
  51. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -0
  52. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/iU/iU7cx0nTwBBaaOT_qzXbI8RiIXouPchtWuIlVcsWWks.cache +0 -0
  53. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/iZ/iZ8YcXqVbBIniScbBCou8v1FocbWLbrgDzpQ5UnVuZI.cache +0 -0
  54. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ig/igCHoAZu1ESqunQb96qV2Dmbt41uWhdJs8ztO5kRXi8.cache +1 -0
  55. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/jq/jqO64m7tXOlADW5o1Sy9C08R_i48GO1Wo0w0mUE4UPg.cache +1 -0
  56. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ko/koq-iWAlxiTFpALhUJsXNVGhxy7qAKZP69zJ8E9YdFY.cache +1 -0
  57. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ml/mlO31cacExw_jelM3vRJ3uZSMqsk-50vvXucoON-bkI.cache +1 -0
  58. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -0
  59. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/ph/phUbOaP6NCn983I6TT7qDlnwcmCAKjJVyDnDfKfjrI0.cache +0 -0
  60. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/pv/pv6tV3CDkIAmLXdU8EPLlNEkXAKJPufVD4VP30o4fWo.cache +0 -0
  61. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/q2/q2rsSyCOy3kUHoKipvqxAw3Z_GfF7PufP5wKBV2EEbA.cache +0 -0
  62. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/qE/qEdbzlDf-HNnbh60QhpqpvwNeEnCU8tTrPEnZAV4NE8.cache +1 -0
  63. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/r-/r-16n5JdDzbIS_kN06fC4J_-GA2dpracXKYNHsLe3d4.cache +0 -0
  64. data/test/dummy/tmp/cache/assets/sprockets/{v3.0/C_/C_C8IqUQirTZx1bt5Ewm3QJvhVbwm66pxvcH0maphFY.cache → v4.0.0/sO/sOS4yyqF_bYEJm1CSvCyiFQcStv5XUNBttwTmekhjv0.cache} +0 -0
  65. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/t3/t3tLjCcLizdoIbYBzZawbDaaD_niNTCxTyMWCAGVBso.cache +1 -0
  66. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/vW/vWfhzaoyrvEUgX0vnRufnld1buC_KEfVE_Y9GxTlEFc.cache +2 -0
  67. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/vo/voyjfPaosDvduWR6jKwI00MuapmfnNxtssiU8OpJCn8.cache +1 -0
  68. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/wq/wq0Gkd5cDkoJX9cTbcFfa70O1tFJZOB-WBE1B6A1D0Q.cache +1 -0
  69. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/x3/x3RXrNrKZMLOtSL6nQa-yFfgd0YP5AaeoP_5isPNggc.cache +1 -0
  70. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/xD/xDCgzYS-NOKY4wQ98x3bpVUmBipKrajnbyKsfZeXyKE.cache +1 -0
  71. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/x_/x_m3GCJB04OFwZrek6vFjk1S_Qbkf1Kr5PAeGvTLUjE.cache +1 -0
  72. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/yw/ywwwCinw2TbO7jW-9-T0BKJdM4rcEDG7yxRiGJAuSqU.cache +0 -0
  73. data/test/dummy/tmp/cache/assets/sprockets/v4.0.0/z8/z86GAeZHuKvb4Z2ApdQizPKZkd9bJy3OH8zcwtNG5bQ.cache +1 -0
  74. data/test/superlogger_test.rb +62 -60
  75. metadata +151 -160
  76. data/lib/superlogger/action_dispatch_debug_exceptions.rb +0 -11
  77. data/lib/superlogger/middleware.rb +0 -31
  78. data/lib/superlogger/rails_rack_logger.rb +0 -11
  79. data/test/dummy/log/development.log +0 -294
  80. data/test/dummy/log/test.log +0 -1672
  81. data/test/dummy/tmp/cache/assets/sprockets/v3.0/5L/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -0
  82. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ch/Ch2bQFHkYziI9Erdkuj8uoPJyw0W2aA5prtYAqlccww.cache +0 -1
  83. data/test/dummy/tmp/cache/assets/sprockets/v3.0/DS/DSOLSc6A5RVSmvM415eEWAWG_AgOvZcLZOXQjsXyWQA.cache +0 -2
  84. data/test/dummy/tmp/cache/assets/sprockets/v3.0/H3/H3tvaQM-yTy-25oSLlfjToAa74LSJHBDUpji-8C-eLg.cache +0 -0
  85. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Iv/IvDM1j8-H1H6kEjVCsyIW8N2zla-aIp9q_OE9PVZtVw.cache +0 -1
  86. data/test/dummy/tmp/cache/assets/sprockets/v3.0/K9/K9ZheMi0hi4DNLzmDMRnv9A_lOVz33kNImc16Now42o.cache +0 -1
  87. data/test/dummy/tmp/cache/assets/sprockets/v3.0/LH/LHgjtAV8kdldaJ_dX0RCznzjmWYRuLdhU29fZCJ0VmU.cache +0 -1
  88. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Nn/NnUCa7jNYx9HCmEB7E7WPWT00DwaM4IYICy1Ju1jjcs.cache +0 -1
  89. data/test/dummy/tmp/cache/assets/sprockets/v3.0/OI/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -0
  90. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ol/OlBX9JIv9SAOmK2t35x1SYDx1sxCXF0yvqpna3WMyH0.cache +0 -1
  91. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Yr/YrZ0OIHu42cExs1kqngMA6ShVDKhfGmhyW-E9haNo5Y.cache +0 -1
  92. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ZU/ZUokoeZcfmoTFE9YAHZRhTgceOUGJTDGH__SCqPfkqU.cache +0 -0
  93. data/test/dummy/tmp/cache/assets/sprockets/v3.0/_I/_IocgQl8XVm84HohovEBj-GxsSeBkOpqN-94yHgY-K8.cache +0 -0
  94. data/test/dummy/tmp/cache/assets/sprockets/v3.0/bJ/bJVgCoQDvMv4iocjEuC3z3WqSeK7LXgxDJ-eXaHl0l4.cache +0 -0
  95. data/test/dummy/tmp/cache/assets/sprockets/v3.0/b_/b_-O1DwVvDk3vPJ-GHDgGWR9Zth9CYblcXbBe6aiTf0.cache +0 -0
  96. data/test/dummy/tmp/cache/assets/sprockets/v3.0/cI/cIaWfk6Nq6ZAr0fhtHGTBtsRITI5n8IJFZbClZ2tExw.cache +0 -0
  97. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gV/gVVPZef0xfm7t9Jyesa7ZVdnpzMpw2QtOyYUoEXO7fk.cache +0 -0
  98. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gZ/gZp3uXMHuYQC4hzCr7bQfetKNdJAtbQmg3so2KpW1Dw.cache +0 -2
  99. data/test/dummy/tmp/cache/assets/sprockets/v3.0/gp/gpiWtnqpufka8lRtMznM6Ko0aWJrcH_j8cfZwdYmzNI.cache +0 -1
  100. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hZ/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -0
  101. data/test/dummy/tmp/cache/assets/sprockets/v3.0/i7/i7v4b6OSQUj-1r9vUWRiOHjAVksSTpUfilZTpk0ACLc.cache +0 -0
  102. data/test/dummy/tmp/cache/assets/sprockets/v3.0/kz/kzdSvu57G4i6eTuarsZCAfbhbICnkRa0Xhi0b9ua6qk.cache +0 -1
  103. data/test/dummy/tmp/cache/assets/sprockets/v3.0/pE/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -0
  104. data/test/dummy/tmp/cache/assets/sprockets/v3.0/rC/rCO5-bHVJ6Y_GsPBmOPUL23pfjvc2Gw2zt_ODmZsygw.cache +0 -1
  105. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vm/vm9zMjZUFULeJsYWRoDd3cvnEpLGK-E5XTk30_NQTEs.cache +0 -0
  106. data/test/dummy/tmp/cache/assets/sprockets/v3.0/wD/wDDl7jzOUTDgFcG1JlpN6jVHavfzB8Smsjtl3d8WDx0.cache +0 -1
  107. data/test/dummy/tmp/cache/sprockets/v3.0/-Z_pj4kfRj993e_ypawYQUIDIDKcRe569udVq_1drFs.cache +0 -1
  108. data/test/dummy/tmp/cache/sprockets/v3.0/2G0Z7Q5fvf2xX8ygtwcD9vZq-kwEzoV2MFc1URegs7s.cache +0 -1
  109. data/test/dummy/tmp/cache/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +0 -2
  110. data/test/dummy/tmp/cache/sprockets/v3.0/66bWF3byFzdKpXZsrn5Vy9CJBaDlkJKkoyqeLRRbBZY.cache +0 -0
  111. data/test/dummy/tmp/cache/sprockets/v3.0/9NtfUddiu2UU8sqL-bYq-NPAx8NGp5m5AYiAWAcKQQ4.cache +0 -0
  112. data/test/dummy/tmp/cache/sprockets/v3.0/DSOLSc6A5RVSmvM415eEWAWG_AgOvZcLZOXQjsXyWQA.cache +0 -2
  113. data/test/dummy/tmp/cache/sprockets/v3.0/GELqHyWyVR_UvkpZPDb5xjZrCgkKB5G067DYoMwTjEA.cache +0 -0
  114. data/test/dummy/tmp/cache/sprockets/v3.0/Gyqn3Ja6WbUSqKnvWm9Xw7FIxFqJIPQ88IlgpguMo1s.cache +0 -1
  115. data/test/dummy/tmp/cache/sprockets/v3.0/H5fHMceViwaxMKkefsdMmVpBN3rRYZI1obJX5Jn-4jw.cache +0 -1
  116. data/test/dummy/tmp/cache/sprockets/v3.0/IEJfj4Zwfra6y7iF-BOVR9PPIQeL9L5IiZT8MRqpCXg.cache +0 -0
  117. data/test/dummy/tmp/cache/sprockets/v3.0/IordxSS9mOh1mkt2VyfX7Iz4DhZhy73lccOYxcw5aVU.cache +0 -1
  118. data/test/dummy/tmp/cache/sprockets/v3.0/KgQHhqXCaYHJSJEG6JweQVe1a2rC-mHfkrqD9p9taTU.cache +0 -2
  119. data/test/dummy/tmp/cache/sprockets/v3.0/Ki_R5uSCGEm1Jn7TSbJOc3eBMn4Q3_IPLG0r_RRn9lA.cache +0 -1
  120. data/test/dummy/tmp/cache/sprockets/v3.0/NBBjlBjfPdkZkp4G7VCEA9LAeGycMn10CxLbDAbNeHc.cache +0 -0
  121. data/test/dummy/tmp/cache/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +0 -2
  122. data/test/dummy/tmp/cache/sprockets/v3.0/V9m2At1eKJAvbGAFvFTUt8hcdNI-G8xW1AShyPYS4Ys.cache +0 -1
  123. data/test/dummy/tmp/cache/sprockets/v3.0/XsDQ8X8Klh__7HZNZk8sjYzyFg5TmATqo-_UraArzN8.cache +0 -1
  124. data/test/dummy/tmp/cache/sprockets/v3.0/ZtbyFLml01tdqcRh4Ocz6XOkbPpmHM6nFRRYY4Nphpc.cache +0 -1
  125. data/test/dummy/tmp/cache/sprockets/v3.0/_ZNMI9IrCfXNcrwiRGttWiFPcLlCSpkdJSFoLhmUpyg.cache +0 -0
  126. data/test/dummy/tmp/cache/sprockets/v3.0/brSVWTme0G1yzUMjrDpklxoQetdFLXdF8ZUkYXFX-sE.cache +0 -1
  127. data/test/dummy/tmp/cache/sprockets/v3.0/gZp3uXMHuYQC4hzCr7bQfetKNdJAtbQmg3so2KpW1Dw.cache +0 -2
  128. data/test/dummy/tmp/cache/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +0 -2
  129. data/test/dummy/tmp/cache/sprockets/v3.0/jqyQL40gGhkqnPg3IttXbq8JGHLONBjR0MlrN9HeIvU.cache +0 -1
  130. data/test/dummy/tmp/cache/sprockets/v3.0/kqQAJDpBuiNJ3XEy8VjtVcyUB9BVlP02oDMdVnlL04w.cache +0 -0
  131. data/test/dummy/tmp/cache/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +0 -2
  132. data/test/dummy/tmp/cache/sprockets/v3.0/pnW3u_1AN48ig6ngefI89y96xoSlvnJurx-e3J-leoE.cache +0 -2
  133. data/test/dummy/tmp/cache/sprockets/v3.0/q9kUTJTzJpwJJQ8CoWPFc_eCW76RZgB-R2sc4P84y6c.cache +0 -0
  134. data/test/dummy/tmp/cache/sprockets/v3.0/qFlPbNZ3UJs9EnENWVEbNWnrTEcjZkAQUzH55y3Ymi0.cache +0 -1
  135. data/test/dummy/tmp/cache/sprockets/v3.0/r86oWGkKGjcta2GtxqeESX1w_4FX1c_DWHxPWVKP28A.cache +0 -1
  136. data/test/dummy/tmp/cache/sprockets/v3.0/ssS2x0Wl67rwXHaVHsh6CO7ayn9fQ5saIwATKN6O-nI.cache +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a8233a0f1140b23ad1a79d954256e9f406e7dbf4
4
- data.tar.gz: 7fc49063ae14c89e033a224dc619e878401d8f33
2
+ SHA256:
3
+ metadata.gz: 6c620e677e4aebf4aea5cab58f2a6e392c5266016eaf32aef3a9a88f96c402fd
4
+ data.tar.gz: 59fd2728e8398194e9188f212d7dc3f1155f1c2f101d0916747fbcbd52d1c23c
5
5
  SHA512:
6
- metadata.gz: 5bf2ca0272093a2b54928be31590756f57ddb0fb959c0fc4fc37cdd074cdaf51adbc903bfd5d549705708b53269e312afeb20ac04af50dec472ff41e7c4082c8
7
- data.tar.gz: 1b181052bfb35cc721824dde111d9d87b4aadc0b8605d944b7c1657e0afff478a1b2052c6033b8df04f64f262de53b84744c709c177bed20985f9799ae8cafef
6
+ metadata.gz: fd1ab3fe21cd6759e6732746fd6e206a71816f9926559098a0815d6940aa058568c9f5204b48dd643fe74b1639ddbe938dc11f9817ce5485058ade00207b451d
7
+ data.tar.gz: b55db9a3bccd0ce12fb20666b40f85d73c43b873ff9c9dab7cc776b3cd4667a7939202a18ab41212f9c33c31f9b5bebfde84a994b2126bf0a58ba8d13528fb5c
data/README.md CHANGED
@@ -1,82 +1,74 @@
1
- Superlogger - Machine-readable logging for Rails [![Build Status](https://travis-ci.org/moexmen/superlogger.svg?branch=master)](https://travis-ci.org/moexmen/superlogger)
1
+ [![Build Status](https://travis-ci.org/moexmen/superlogger.svg?branch=master)](https://travis-ci.org/moexmen/superlogger)
2
+ [![Gem Version](https://badge.fury.io/rb/superlogger.svg)](https://badge.fury.io/rb/superlogger)
3
+ [![Dependency Status](https://gemnasium.com/badges/github.com/moexmen/superlogger.svg)](https://gemnasium.com/github.com/moexmen/superlogger)
4
+
5
+ Superlogger - Machine-readable logging for Rails
2
6
  =======
3
7
 
4
- Rails' default request logging is easy to read for humans but difficult for log aggregators such as Kibana, Graylog and Splunk. Superlogger transforms the logs into key-value pairs for easy parsing and adds useful details like Timestamp and Session ID for tracing purposes.
8
+ Rails' default request logging is easy to read for humans but difficult for log aggregators such as Kibana, Graylog and Splunk. Superlogger transforms the logs into JSON for easy parsing and adds useful details like Timestamp, Session ID and Request ID for tracing purposes.
5
9
 
6
10
  Default rails logging:
7
11
  ```sh
8
- Started GET "/home/index" for ::1 at 2016-04-11 16:23:27 +0800
12
+ Started GET "/home/index" for ::1 at 2016-04-29 17:31:12 +0800
9
13
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
10
14
  Processing by HomeController#index as HTML
11
- Something Load (0.2ms) SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 [["paper", "123"], ["stone", "456"]]
15
+ Something Load (0.1ms) SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 [["paper", "123"], ["stone", "456"]]
12
16
  Rendered home/_partial.html.erb (0.2ms)
13
- Rendered home/index.html.erb within layouts/application (5.2ms)
14
- Completed 200 OK in 283ms (Views: 271.6ms | ActiveRecord: 0.6ms)
17
+ Rendered home/index.html.erb within layouts/application (3.4ms)
18
+ Completed 200 OK in 135ms (Views: 130.7ms | ActiveRecord: 0.3ms)
19
+
20
+ Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-04-29 17:31:12 +0800
15
21
 
16
- Started GET "/assets/application.self-e80e8f2318043e8af94dddc2adad5a4f09739a8ebb323b3ab31cd71d45fd9113.css?body=1" for ::1 at 2016-04-11 16:23:27 +0800
22
+ Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2016-04-29 17:31:12 +0800
17
23
 
18
- Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2016-04-11 16:23:27 +0800
19
24
  ```
20
25
 
21
- Machine-readable logging with Superlogger:
26
+ With Superlogger:
22
27
  ```sh
23
- 2016-04-11 16:18:22.279 | b48534ea049a | I | middleware:28 | method=GET | path=/home/index | ip=::1
24
- 2016-04-11 16:18:22.293 | b48534ea049a | D | action_controller_log_subscriber:9 | controller=HomeController | action=index | params={}
25
- 2016-04-11 16:18:22.305 | b48534ea049a | D | active_record_log_subscriber:24 | sql=SELECT "somethings".* FROM "somethings" WHERE "somethings"."paper" = ? AND "somethings"."stone" = ? ORDER BY "somethings"."id" ASC LIMIT 1 | params=["'123'", "'456'"] | duration=0.48
26
- 2016-04-11 16:18:22.316 | b48534ea049a | D | action_view_log_subscriber:6 | view=_partial.html.erb | duration=0.3
27
- 2016-04-11 16:18:22.316 | b48534ea049a | D | action_view_log_subscriber:6 | view=index.html.erb | duration=5.6
28
- 2016-04-11 16:18:22.541 | b48534ea049a | I | action_controller_log_subscriber:29 | status=200 | total_duration=247.16 | view_duration=235.25 | db_duration=0.78
28
+ {"level":"debug","ts":1590972589.522784,"caller":"superlogger/active_record_log_subscriber:21","sql":"SELECT \"schema_migrations\".\"version\" FROM \"schema_migrations\" ORDER BY \"schema_migrations\".\"version\" ASC","params":[],"duration":0.13}
29
+ {"level":"info","ts":1590972589.526133,"caller":"superlogger/superlogger_middleware:21","session_id":"90e90c75c72c","request_id":"34432478c89b4d8591e02e0169b40a56","method":"GET","path":"/home/index"}
30
+ {"level":"debug","ts":1590972589.546272,"caller":"superlogger/action_controller_log_subscriber:8","session_id":"90e90c75c72c","request_id":"34432478c89b4d8591e02e0169b40a56","controller":"HomeController","action":"index","params":{}}
31
+ {"level":"debug","ts":1590972589.55092,"caller":"superlogger/active_record_log_subscriber:21","session_id":"90e90c75c72c","request_id":"34432478c89b4d8591e02e0169b40a56","sql":"SELECT \"somethings\".* FROM \"somethings\" WHERE \"somethings\".\"paper\" = ? AND \"somethings\".\"stone\" = ? ORDER BY \"somethings\".\"id\" ASC LIMIT ?","params":["123","456","1"],"duration":0.22}
32
+ {"level":"debug","ts":1590972589.574199,"caller":"superlogger/action_view_log_subscriber:6","session_id":"90e90c75c72c","request_id":"34432478c89b4d8591e02e0169b40a56","view":"_partial.html.erb","duration":0.33}
33
+ {"level":"debug","ts":1590972589.574795,"caller":"superlogger/action_view_log_subscriber:6","session_id":"90e90c75c72c","request_id":"34432478c89b4d8591e02e0169b40a56","view":"index.html.erb","duration":2.95}
34
+ {"level":"info","ts":1590972589.61165,"caller":"superlogger/action_controller_log_subscriber:20","session_id":"90e90c75c72c","request_id":"34432478c89b4d8591e02e0169b40a56","view_duration":54.59,"db_duration":0.85}
35
+ {"level":"info","ts":1590972589.611928,"caller":"superlogger/superlogger_middleware:30","session_id":"90e90c75c72c","request_id":"34432478c89b4d8591e02e0169b40a56","method":"GET","path":"/home/index","response_time":85.65,"status":200}
29
36
  ```
30
37
 
31
- ## Features ##
32
- - Timestamp (milliseconds)
33
- - Session ID for logs across requests
34
- - Key-value pairs for log data
35
- - Muting of assets logging
36
- - File and line numbers
37
- - Recording of IP address
38
-
39
38
  ## Installation ##
40
39
 
41
40
  Add superlogger to your application's Gemfile
42
-
43
41
  ```ruby
44
42
  gem "superlogger"
45
43
  ```
46
44
 
47
- And then execute:
48
-
45
+ Execute:
49
46
  ```sh
50
47
  $ bundle
51
48
  ```
52
49
 
53
- ## Usage ##
50
+ And add the following in `config/environment/production.rb`
51
+ ```ruby
52
+ config.logger = Superlogger::Logger.new(STDOUT)
53
+ ```
54
54
 
55
+ By default, Superlogger is only enabled in production environment because JSON is easy for machines to parse but difficult for humans to read. To forcefully enable Superlogger in non-production environment, set in `config/application.rb`:
55
56
  ```ruby
56
- require 'superlogger'
57
-
58
- class SomeClass
59
- include Superlogger
60
-
61
- def some_method
62
- Logger.debug name:'john', age: '21'
63
- Logger.info name:'john', age: '21'
64
- Logger.warn name:'john', age: '21'
65
- Logger.error name:'john', age: '21'
66
- Logger.fatal name:'john', age: '21'
67
- end
68
- end
57
+ Superlogger.enabled = true
69
58
  ```
70
59
 
71
- ## Output Format ##
72
- ```sh
73
- 2015-03-26 23:37:38.086 | 970298669a40 | I | log_subscriber:24 | status:200 | total:858.35 | view:597.46 | db:34.96
74
- < timestamp > | < session id > | < severity > | < file >:< line num > | < data you pass in ... >
60
+ ## Usage ##
61
+
62
+ Log as per normal using `Rails.logger`.
63
+
64
+ ```ruby
65
+ Rails.logger.info foo:'true', bar: 'false'
66
+ Rails.logger.info "Meatball"
75
67
  ```
76
68
 
77
- ### Severity Levels ###
78
- - **D** - Debug
79
- - **I** - Info
80
- - **W** - Warn
81
- - **E** - Error
82
- - **F** - Fatal
69
+ ## Log Format ##
70
+ - `ts` = Unix Epoch timestamp
71
+ - `session_id` = Truncated to 12 characters
72
+ - `request_id` = 32 characters
73
+ - `msg` = If values given is not a hash, it is treated as `{"msg":<value>"}`
74
+ - All duration related fields are in milliseconds
@@ -2,46 +2,47 @@ require 'superlogger/version'
2
2
  require 'superlogger/logger'
3
3
 
4
4
  module Superlogger
5
+ @@enabled = false
6
+
5
7
  module_function
6
8
 
7
9
  def setup(app)
8
- overwrite_rails_rack_logger
9
- overwrite_action_dispatch_debug_exceptions
10
+ return unless (Rails.env.production? || enabled)
11
+
10
12
  insert_superlogger_middleware(app)
11
- detach_all_existing_log_subscribers
13
+ detach_existing_log_subscribers
12
14
  attach_superlogger_log_subscribers
13
15
  end
14
16
 
15
- def overwrite_rails_rack_logger
16
- require 'superlogger/rails_rack_logger'
17
- end
18
-
19
- def overwrite_action_dispatch_debug_exceptions
20
- require 'superlogger/action_dispatch_debug_exceptions'
21
- end
22
-
23
17
  def insert_superlogger_middleware(app)
24
- require 'superlogger/middleware'
18
+ require 'superlogger/superlogger_middleware'
25
19
 
26
20
  # important to insert after session middleware so we can get the session id
27
- app.middleware.use Superlogger::Middleware
21
+ app.middleware.use Superlogger::SuperloggerMiddleware
28
22
  end
29
23
 
30
- def detach_all_existing_log_subscribers
24
+ def detach_existing_log_subscribers
31
25
  # force log subscribers to attach first so we can remove them all
32
26
  require 'action_controller/log_subscriber'
33
27
  require 'active_record/log_subscriber'
34
28
  require 'action_view/log_subscriber'
35
- require 'action_mailer/log_subscriber'
36
29
 
37
30
  # remove log subscribers
31
+ remove_patterns = %w(sql.active_record
32
+ start_processing.action_controller
33
+ process_action.action_controller
34
+ render_template.action_view
35
+ render_partial.action_view
36
+ render_collection.action_view)
37
+
38
38
  ActiveSupport::LogSubscriber.log_subscribers.each do |subscriber|
39
- subscriber.patterns.each do |pattern|
40
- ActiveSupport::Notifications.unsubscribe pattern
39
+ patterns = subscriber.patterns
40
+ patterns = patterns.is_a?(Hash) ? patterns.keys : patterns
41
+
42
+ patterns.each do |pattern|
43
+ ActiveSupport::Notifications.unsubscribe pattern if remove_patterns.include?(pattern)
41
44
  end
42
45
  end
43
-
44
- ActiveSupport::LogSubscriber.log_subscribers.clear
45
46
  end
46
47
 
47
48
  def attach_superlogger_log_subscribers
@@ -49,6 +50,30 @@ module Superlogger
49
50
  require 'superlogger/action_view_log_subscriber'
50
51
  require 'superlogger/active_record_log_subscriber'
51
52
  end
53
+
54
+ def session_id=(session_id)
55
+ RequestStore.store[:superlogger_session_id] = session_id
56
+ end
57
+
58
+ def session_id
59
+ RequestStore.store[:superlogger_session_id]
60
+ end
61
+
62
+ def request_id=(request_id)
63
+ RequestStore.store[:superlogger_request_id] = request_id
64
+ end
65
+
66
+ def request_id
67
+ RequestStore.store[:superlogger_request_id]
68
+ end
69
+
70
+ def enabled=(enabled)
71
+ @@enabled=enabled
72
+ end
73
+
74
+ def enabled
75
+ @@enabled
76
+ end
52
77
  end
53
78
 
54
79
  require 'superlogger/railtie' if defined?(Rails)
@@ -5,28 +5,19 @@ module Superlogger
5
5
  # start of controller action
6
6
  def start_processing(event)
7
7
  payload = event.payload
8
-
9
- Logger.debug controller: payload[:controller], action: payload[:action], params: payload[:params].except(*INTERNAL_PARAMS)
8
+ logger.debug {{ controller: payload[:controller], action: payload[:action], params: payload[:params].except(*INTERNAL_PARAMS) }}
10
9
  end
11
10
 
12
11
  # end of controller action
13
12
  def process_action(event)
14
13
  payload = event.payload
14
+ view_duration = payload[:view_runtime].to_f.round(2) if payload.key?(:view_runtime)
15
+ db_duration = payload[:db_runtime].to_f.round(2) if payload.key?(:db_runtime)
15
16
 
16
17
  if payload[:exception]
17
- status = ActionDispatch::ExceptionWrapper.status_code_for_exception(payload[:exception][0])
18
-
19
- Logger.fatal status: status, exception: payload[:exception]
18
+ logger.fatal view_duration: view_duration, db_duration: db_duration, exception: payload[:exception]
20
19
  else
21
- # Assume status 401 if action finishes without status code and no exception
22
- # https://github.com/pcg79/devise/commit/1e2dab3c0ce49efe2b5940c15f47388c69d6731b
23
- payload[:status] ||= 401
24
-
25
- total_duration = event.duration.to_f.round(2)
26
- view_duration = payload[:view_runtime].to_f.round(2) if payload.key?(:view_runtime)
27
- db_duration = payload[:db_runtime].to_f.round(2) if payload.key?(:db_runtime)
28
-
29
- Logger.info status: payload[:status], total_duration: total_duration, view_duration: view_duration, db_duration: db_duration
20
+ logger.info view_duration: view_duration, db_duration: db_duration
30
21
  end
31
22
  end
32
23
  end
@@ -3,7 +3,7 @@ module Superlogger
3
3
  def render_template(event)
4
4
  payload = event.payload
5
5
 
6
- Logger.debug view: payload[:identifier].split('/').last, duration: event.duration.round(1)
6
+ logger.debug {{ view: payload[:identifier].split('/').last, duration: event.duration.round(2) }}
7
7
  end
8
8
  alias :render_partial :render_template
9
9
  alias :render_collection :render_template
@@ -18,10 +18,12 @@ module Superlogger
18
18
  payload = event.payload
19
19
  return if IGNORE_PAYLOAD_NAMES.include?(payload[:name])
20
20
 
21
- sql = payload[:sql]
22
- params = payload[:binds].map { |_, value| "'#{value}'"}
21
+ logger.debug do
22
+ sql = payload[:sql]
23
+ params = payload[:binds].map { |b| b.value.to_s }
23
24
 
24
- Logger.debug sql: sql, params: params, duration: event.duration.round(2)
25
+ { sql: sql, params: params, duration: event.duration.round(2) }
26
+ end
25
27
  end
26
28
  end
27
29
  end
@@ -1,79 +1,48 @@
1
1
  require 'request_store'
2
2
 
3
3
  module Superlogger
4
- module Logger
5
- def self.session_id=(session_id)
6
- RequestStore.store[:superlogger_session_id] = session_id
7
- end
4
+ class Logger < ActiveSupport::Logger
5
+ def format_message(severity, time, _progname, msg)
6
+ return nil if msg.blank? # Silence nil and empty msg
7
+ return nil if is_rails_rack_logger_msg?(msg) # Silence rack logger msg
8
8
 
9
- def self.session_id
10
- RequestStore.store[:superlogger_session_id] || "NS-#{Thread.current.object_id}"
11
- end
9
+ msg = {msg: msg} unless msg.is_a?(Hash)
12
10
 
13
- def self.debug(*args)
14
- Rails.logger.debug { format_msg(args) }
15
- end
16
-
17
- def self.info(*args)
18
- Rails.logger.info { format_msg(args) }
19
- end
20
-
21
- def self.warn(*args)
22
- Rails.logger.warn { format_msg(args) }
23
- end
24
-
25
- def self.error(*args)
26
- Rails.logger.error { format_msg(args) }
27
- end
11
+ h = {}
12
+ h[:level] = severity.downcase
13
+ h[:ts] = time.to_f
14
+ h[:caller] = get_caller_location
15
+ h[:session_id] = Superlogger.session_id[0..11] unless Superlogger.session_id.nil?
16
+ h[:request_id] = Superlogger.request_id unless Superlogger.request_id.nil?
17
+ h.merge!(msg)
28
18
 
29
- def self.fatal(*args)
30
- Rails.logger.fatal { format_msg(args) }
19
+ h.to_json + "\n"
31
20
  end
32
21
 
33
- private
34
-
35
- def self.format_msg(args)
36
- "#{get_caller_location} | #{format_args(args)}"
22
+ def is_rails_rack_logger_msg?(msg)
23
+ return false unless msg.is_a?(String)
24
+ msg =~ /Started (GET|POST|PUT|PATCH|DELETE)/
37
25
  end
38
26
 
39
- def self.get_caller_location
40
- # Find the last method call on Superlogger::Logger
41
- count = 0
42
- location_index = caller_locations(0).find_index do |location|
43
- count += 1 if location && location.path.include?('superlogger/logger.rb')
44
- count == 4
45
- end
46
-
47
- # Add 1 to get the caller of the logger
48
- location = caller_locations(location_index + 1).first
27
+ def get_caller_location
28
+ index = caller_locations(4, 1).first.label.include?('broadcast') ? 6 : 5
29
+ location = caller_locations(index, 1).first
49
30
 
50
- # extract filename without file extension from location.path
51
- # eg. superlogger/lib/superlogger/logger.rb
52
- file = location.path.split('/').last.split('.').first
31
+ # Extract filename without file extension from location.path
32
+ # eg. superlogger/lib/superlogger/logger.rb => superlogger/logger
33
+ file = location.path.split('/').last(2).join('/').split('.').first
53
34
 
54
35
  "#{file}:#{location.lineno}"
55
36
  end
56
37
 
57
- def self.format_args(args)
58
- # format args in key=value pair, separated by pipes
59
- args.map do |arg|
60
- arg = {nil: arg} unless arg.is_a?(Hash)
61
-
62
- arg.map do |key, value|
63
- "#{key}=#{value}"
38
+ # To silence double logging when running `rails server` in development mode
39
+ # See: https://github.com/rails/rails/commit/3d10d9d6c3b831fe9632c43a0ffec46104f912a7
40
+ if Rails.env.development?
41
+ class SimpleFormatter < ::Logger::Formatter
42
+ def call(_severity, _timestamp, _progname, _msg)
43
+ nil
64
44
  end
65
- end.flatten.join(' | ')
45
+ end
66
46
  end
67
47
  end
68
48
  end
69
-
70
- # for overriding default Rails Logger format
71
- class Logger
72
- def format_message(severity, time, _progname, msg)
73
- timestamp = time.strftime('%Y-%m-%d %H:%M:%S.%L')
74
- session_id = Superlogger::Logger.session_id[0..11]
75
- severity = severity.to_s.upcase[0]
76
-
77
- "#{timestamp} | #{session_id} | #{severity} | #{msg}\n"
78
- end
79
- end
@@ -0,0 +1,47 @@
1
+ module Superlogger
2
+ class SuperloggerMiddleware
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ def call(env)
8
+ request = ActionDispatch::Request.new(env)
9
+
10
+ if request.path.start_with?('/assets/') == false
11
+ process_request(request) { @app.call(env) }
12
+ else
13
+ @app.call(env)
14
+ end
15
+ end
16
+
17
+ def process_request(request)
18
+ setup_logging(request)
19
+
20
+ # Start of request
21
+ Rails.logger.info method: request.method, path: request.fullpath
22
+
23
+ t1 = Time.now
24
+ status, _headers, _response = yield
25
+ ensure
26
+ t2 = Time.now
27
+
28
+ # End of request
29
+ duration = ((t2 - t1) * 1000).to_f.round(2)
30
+ Rails.logger.info method: request.method, path: request.fullpath, response_time: duration, status: status
31
+
32
+ [status, _headers, _response]
33
+ end
34
+
35
+ def setup_logging(request)
36
+ if request.env['rack.session']
37
+ # Session is lazy loaded. Force session to load if it is not already loaded.
38
+ request.env['rack.session'].send(:load!) unless request.env['rack.session'].id
39
+
40
+ # Store session id before any actual logging is done
41
+ Superlogger.session_id = request.env['rack.session'].id.to_s
42
+ end
43
+
44
+ Superlogger.request_id = request.uuid.try(:gsub, '-', '')
45
+ end
46
+ end
47
+ end