+1
-1
@@ -28,4 +28,4 @@ 'use strict'; | ||
| // @todo Add browser support. | ||
| process.stderr.write(body); | ||
| process.stderr.write(body + '\n'); | ||
| }); | ||
| //# sourceMappingURL=log.js.map |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../src/log.js"],"names":["ROARR_LOG","process","env","message","body","JSON","stringify","stderr","write"],"mappings":";;;;;;AAEA;;;;AACA;;;;AAIA;AAPA;;AAQA,IAAMA,YAAY,uBAAaC,QAAQC,GAAR,CAAYF,SAAzB,MAAwC,IAA1D;;kBAEe,6BAAa,UAACG,OAAD,EAAa;AACvC,MAAI,CAACH,SAAL,EAAgB;AACd;AACD;;AAED,MAAMI,OAAOC,KAAKC,SAAL,CAAeH,OAAf,CAAb;;AAEA;AACAF,UAAQM,MAAR,CAAeC,KAAf,CAAqBJ,IAArB;AACD,CATc,C","file":"log.js","sourcesContent":["// @flow\n\nimport parseBoolean from 'boolean';\nimport {\n createLogger\n} from './factories';\n\n// eslint-disable-next-line no-process-env\nconst ROARR_LOG = parseBoolean(process.env.ROARR_LOG) === true;\n\nexport default createLogger((message) => {\n if (!ROARR_LOG) {\n return;\n }\n\n const body = JSON.stringify(message);\n\n // @todo Add browser support.\n process.stderr.write(body);\n});\n"]} | ||
| {"version":3,"sources":["../src/log.js"],"names":["ROARR_LOG","process","env","message","body","JSON","stringify","stderr","write"],"mappings":";;;;;;AAEA;;;;AACA;;;;AAIA;AAPA;;AAQA,IAAMA,YAAY,uBAAaC,QAAQC,GAAR,CAAYF,SAAzB,MAAwC,IAA1D;;kBAEe,6BAAa,UAACG,OAAD,EAAa;AACvC,MAAI,CAACH,SAAL,EAAgB;AACd;AACD;;AAED,MAAMI,OAAOC,KAAKC,SAAL,CAAeH,OAAf,CAAb;;AAEA;AACAF,UAAQM,MAAR,CAAeC,KAAf,CAAqBJ,OAAO,IAA5B;AACD,CATc,C","file":"log.js","sourcesContent":["// @flow\n\nimport parseBoolean from 'boolean';\nimport {\n createLogger\n} from './factories';\n\n// eslint-disable-next-line no-process-env\nconst ROARR_LOG = parseBoolean(process.env.ROARR_LOG) === true;\n\nexport default createLogger((message) => {\n if (!ROARR_LOG) {\n return;\n }\n\n const body = JSON.stringify(message);\n\n // @todo Add browser support.\n process.stderr.write(body + '\\n');\n});\n"]} |
+1
-1
@@ -71,3 +71,3 @@ { | ||
| }, | ||
| "version": "1.2.0" | ||
| "version": "1.2.1" | ||
| } |
+36
-11
@@ -26,2 +26,3 @@ # Roarr | ||
| * [Conventions](#conventions) | ||
| * [Context property names](#context-property-names) | ||
| * [Using Roarr in an application](#using-roarr-in-an-application) | ||
@@ -60,6 +61,6 @@ | ||
| ``` | ||
| {"context":{},"message":"foo","sequence":0,"time":1506776210001,"version":"1.0.0"} | ||
| {"context":{},"message":"bar baz","sequence":1,"time":1506776210002,"version":"1.0.0"} | ||
| {"context":{"level":"debug"},"message":"qux","sequence":2,"time":1506776210003,"version":"1.0.0"} | ||
| {"context":{"level":"debug","quuz":"corge"},"sequence":3,"message":"quux","time":1506776210004,"version":"1.0.0"} | ||
| {"context":{},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{},"message":"bar baz","sequence":1,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"level":"debug"},"message":"qux","sequence":2,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"level":"debug","quuz":"corge"},"sequence":3,"message":"quux","time":1506776210000,"version":"1.0.0"} | ||
@@ -92,5 +93,5 @@ ``` | ||
| ``` | ||
| {"context":{},"message":"foo","sequence":0,"time":1506776210001,"version":"1.0.0"} | ||
| {"context":{"taskId":1},"message":"bar","sequence":1,"time":1506776210002,"version":"1.0.0"} | ||
| {"context":{},"message":"baz","sequence":2,"time":1506776210003,"version":"1.0.0"} | ||
| {"context":{},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"taskId":1},"message":"bar","sequence":1,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{},"message":"baz","sequence":2,"time":1506776210000,"version":"1.0.0"} | ||
@@ -133,5 +134,5 @@ ``` | ||
| ``` | ||
| {"context":{"taskId":1},"message":"starting task ID 1","sequence":0,"time":1506776210001,"version":"1.0.0"} | ||
| {"context":{"taskId":1},"message":"foo","sequence":1,"time":1506776210002,"version":"1.0.0"} | ||
| {"context":{"taskId":1},"message":"successfully completed task ID 1","sequence":2,"time":1506776210003,"version":"1.0.0"} | ||
| {"context":{"taskId":1},"message":"starting task ID 1","sequence":0,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"taskId":1},"message":"foo","sequence":1,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"taskId":1},"message":"successfully completed task ID 1","sequence":2,"time":1506776210000,"version":"1.0.0"} | ||
| [...] | ||
@@ -220,3 +221,8 @@ | ||
| log.trace('foo'); | ||
| log.debug('foo'); | ||
| log.info('foo'); | ||
| log.warn('foo'); | ||
| log.error('foo'); | ||
| log.fatal('foo'); | ||
@@ -228,3 +234,8 @@ ``` | ||
| ``` | ||
| {"context":{"logLevel":"debug"},"message":"foo","sequence":0,"time":1506776210001,"version":"1.0.0"} | ||
| {"context":{"logLevel":"trace"},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"logLevel":"debug"},"message":"foo","sequence":1,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"logLevel":"info"},"message":"foo","sequence":2,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"logLevel":"warn"},"message":"foo","sequence":3,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"logLevel":"error"},"message":"foo","sequence":4,"time":1506776210000,"version":"1.0.0"} | ||
| {"context":{"logLevel":"fatal"},"message":"foo","sequence":5,"time":1506776210000,"version":"1.0.0"} | ||
@@ -257,2 +268,13 @@ ``` | ||
| ### Context property names | ||
| Roarr does not have reserved context property names. However, I encourage use of the following conventions: | ||
| |Context property name|Use case| | ||
| |---|---| | ||
| |`application`|Name of the application (do not use in code intended for distribution; see `package` property instead).| | ||
| |`package`|Name of the package.| | ||
| |`logLevel`|Human-readable name of the log-level, e.g. "error". See [API](#api) for build-in loggers with a pre-set log-level.| | ||
| |`namespace`|Namespace within a package, e.g. function name. Treat the same way that you would construct namespaces when using the [`debug`](https://github.com/visionmedia/debug) package.| | ||
| ### Using Roarr in an application | ||
@@ -276,2 +298,5 @@ | ||
| // those of the "my-application" dependencies. | ||
| // | ||
| // Note: If you are adding logger to a package intended to be consumed by other | ||
| // packages, you must not set `global.ROARR.prepend`. Instead, use `roarr#child`. | ||
| global.ROARR.prepend = { | ||
@@ -278,0 +303,0 @@ ...global.ROARR.prepend, |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
27430
5.74%309
8.8%