{"_id":"2b-logger","_rev":"4-d07db875f9a9bd5143c96dbc24350d44","name":"2b-logger","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"2b-logger","version":"0.0.1","description":"A simple JS logger","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/tberne/js-logger.git"},"keywords":["logger"],"author":{"name":"Thiago Berne"},"license":"MIT","bugs":{"url":"https://github.com/tberne/js-logger/issues"},"homepage":"https://github.com/tberne/js-logger#readme","dependencies":{"chalk":"^2.3.2","lodash":"^4.17.5","log-symbols":"^2.2.0","strip-ansi":"^4.0.0","time-stamp":"^2.0.0"},"gitHead":"bfb16bf05688ca073cd118119c860cd674511562","_id":"2b-logger@0.0.1","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"tberne","email":"thiago.berne@gmail.com"},"dist":{"integrity":"sha512-jZNSPBhKuLNE/PeW3Ats6h7EvSMXJo7Yxqr79TRZfHiQfikJkPSKYXxBaKsu9qbMUgF0jQ1hy5CMDzqUf05Z1A==","shasum":"dd8cb9a86000b5aca5bb027fe762bde4a83fbae9","tarball":"https://registry.npmjs.org/2b-logger/-/2b-logger-0.0.1.tgz","fileCount":5,"unpackedSize":6934,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8GnqwNItQ2VV/Nt3j7LzWx6CFfdcYMQpDVBfmEdiZbwIgLQYaJ0Yogtxin5Gp1d2u9KxOaUNbpjZCEydknm6jTH0="}]},"maintainers":[{"name":"tberne","email":"thiago.berne@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2b-logger_0.0.1_1523212799028_0.5256177398869071"},"_hasShrinkwrap":false},"0.0.2":{"name":"2b-logger","version":"0.0.2","description":"A simple JS logger","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/2bernes/js-logger.git"},"keywords":["logger"],"author":{"name":"Thiago Berne"},"license":"MIT","bugs":{"url":"https://github.com/2bernes/js-logger/issues"},"homepage":"https://github.com/2bernes/js-logger#readme","dependencies":{"chalk":"^2.3.2","lodash":"^4.17.5","log-symbols":"^2.2.0","strip-ansi":"^4.0.0","time-stamp":"^2.0.0"},"gitHead":"a550502592c765aea3043abc5f598e4460a343e6","_id":"2b-logger@0.0.2","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"tberne","email":"thiago.berne@gmail.com"},"dist":{"integrity":"sha512-2pif13TeNXL/M+dQGNJcwYmQdeDQDZag+qFiNuUcfAR7c8nuoia9b7pAmfFO7nHCkjpoROcrNkakfOH/GA+IgA==","shasum":"888a175774b15f0142fa6981178ebcf986666bdc","tarball":"https://registry.npmjs.org/2b-logger/-/2b-logger-0.0.2.tgz","fileCount":5,"unpackedSize":9605,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMyCl63PkN2mhOmKnBmb4EB9e3tnc/2SGJrbDlY4HqMQIhAK2mMkctNdK37J93foPqmt/4W2alW/8KCGV2f6TyLyZa"}]},"maintainers":[{"name":"tberne","email":"thiago.berne@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2b-logger_0.0.2_1523216559551_0.8555465564996569"},"_hasShrinkwrap":false},"0.0.3":{"name":"2b-logger","version":"0.0.3","description":"A simple JS logger","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/2bernes/js-logger.git"},"keywords":["logger"],"author":{"name":"Thiago Berne"},"license":"MIT","bugs":{"url":"https://github.com/2bernes/js-logger/issues"},"homepage":"https://github.com/2bernes/js-logger#readme","dependencies":{"chalk":"^2.3.2","lodash":"^4.17.5","log-symbols":"^2.2.0","strip-ansi":"^4.0.0","time-stamp":"^2.0.0"},"gitHead":"0a969bc3b04c087fd9691e7fe1d4778662da89a1","_id":"2b-logger@0.0.3","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"tberne","email":"thiago.berne@gmail.com"},"dist":{"integrity":"sha512-eRlg4iGHC3f6aSTxAI8VchS71vZ1XJCHXDq5UlMbiXN7PH+c2O9K62lV1vTSQuWVvCQkjmnrGvmZUJAl90wwYQ==","shasum":"61abadff7d5a1528a1cb686b10c913737cf235e3","tarball":"https://registry.npmjs.org/2b-logger/-/2b-logger-0.0.3.tgz","fileCount":6,"unpackedSize":34669,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4iv8gQjDTwILYDzBWggOxsTHeXOIFcNqtgPYoft44igIgYNZkB+jf0fMtR5wBk30vk6zrvSFf8GI3h4Q3fdV1CXc="}]},"maintainers":[{"name":"tberne","email":"thiago.berne@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2b-logger_0.0.3_1523218604863_0.6930006216894979"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-08T18:39:59.027Z","0.0.1":"2018-04-08T18:39:59.114Z","modified":"2022-04-04T10:18:43.167Z","0.0.2":"2018-04-08T19:42:39.633Z","0.0.3":"2018-04-08T20:16:44.993Z"},"maintainers":[{"name":"tberne","email":"thiago.berne@gmail.com"}],"description":"A simple JS logger","homepage":"https://github.com/2bernes/js-logger#readme","keywords":["logger"],"repository":{"type":"git","url":"git+https://github.com/2bernes/js-logger.git"},"author":{"name":"Thiago Berne"},"bugs":{"url":"https://github.com/2bernes/js-logger/issues"},"license":"MIT","readme":"# 2b-logger\nA simple to use [JS logger](https://github.com/2bernes/js-logger).\n\n## Installation\n```\n\tnpm install 2b-logger\n```\n\nIf you want to save the install in `package.json`:\n```\n\tnpm install --save 2b-logger\n```\nOr\n```\n\tnpm install --save-dev 2b-logger\n```\n\n## Basic usage\nThe basic usage for this logger is the following:\n\n``` JS\n\tconst loggerConstructor = require ( \"2b-logger\" );\n\tconst logger = loggerConstructor ();\n\tlogger.info(\"A nice info message\");\n```\n\nOr, in a simplified version:\n\n``` JS\n\tconst logger = require ( \"2b-logger\" ) ();\n\tlogger.info(\"A nice info message\");\n```\n\nThe import `require ( \"2b-logger\" )` will return a constructor function that takes, optionally, a configuration object.\n\nThe default options are:\n\n``` JSON\n\t{\n\t\t\"level\": \"info\",\n\t\t\"noColor\": false,\n\t\t\"timestampFormat\": \"YYYY-MM-DD @ HH:mm:ss:ms\"\n\t}\n```\n\n## Options\nThe options object can receive the following configurations:\n\n#### `level` (string, default: `info`)\nThe level indicates which messages will be logged and which will be discarded.\nThe accepted values are `trace`, `debug`, `info`, `warn` and `error`.\n\nThe following table displays which messages will be logged, depending on the configured level:\n\n<table style=\"border: 1px #000 solid\">\n\t<tr>\n\t\t<td rowspan=\"2\"></td>\n\t\t<th colspan=\"6\" style=\"text-align: center\">Configured Level</th>\n\t</tr>\n\t<tr>\n\t\t<th></th>\n\t\t<th><code>trace</code></th>\n\t\t<th><code>debug</code></th>\n\t\t<th><code>info</code></th>\n\t\t<th><code>warn</code></th>\n\t\t<th><code>error</code></th>\n\t</tr>\n\t<tr>\n\t\t<th rowspan=\"5\" style=\"vertical-align: middle\">Message Level:</th>\n\t\t<th><code>trace</code></th>\n\t\t<td>✔️</td>\n\t\t<td>❌</td>\n\t\t<td>❌</td>\n\t\t<td>❌</td>\n\t\t<td>❌</td>\n\t</tr>\n\t<tr>\n\t\t<th><code>debug</code></th>\n\t\t<td>✔️</td>\n\t\t<td>️️️️️✔️️️️️</td>\n\t\t<td>❌</td>\n\t\t<td>❌</td>\n\t\t<td>❌</td>\n\t</tr>\n\t<tr>\n\t\t<th><code>info</code> or <code>success</code></th>\n\t\t<td>✔️</td>\n\t\t<td>✔️</td>\n\t\t<td>✔️</td>\n\t\t<td>❌</td>\n\t\t<td>❌</td>\n\t</tr>\n\t<tr>\n\t\t<th><code>warn</code></th>\n\t\t<td>✔️</td>\n\t\t<td>✔️</td>\n\t\t<td>✔️</td>\n\t\t<td>✔️</td>\n\t\t<td>❌</td>\n\t</tr>\n\t<tr>\n\t\t<th><code>error</code></th>\n\t\t<td>✔️</td>\n\t\t<td>✔️</td>\n\t\t<td>✔️</td>\n\t\t<td>✔️</td>\n\t\t<td>✔️️</td>\n\t</tr>\n</table>\n\nMessages with the `success` level are considered to be of `info` level, but they have a different render style.\n\n#### `noColor` (boolean, default: `false`)\nThis boolean option indicates the logger that no color should be added to rendered messages.\n\nEven if logged messages are colored, they will have the color removed, if `noColor` was set as `true`.\n\nExample:\n``` JS\n\tconst logger = require ( \"2b-logger\" ) ({ noColor: true });\n\tconst chalk = require ( \"chalk\" );\n\tlogger.info ( chalk.cyan ( \"A cyan message\" ) );\n```\n\nIn this case, the redered message **will not** have colors.\n\n#### `timestampFormat` (string, default: `YYYY-MM-DD @ HH:mm:ss:ms`)\nThis is the timestamp format to be used when rendering messages.\nThe accepted format can be seen [here](https://github.com/jonschlinkert/time-stamp).\n\n\n## API\nOnce a logger has been created, the following methods are available in it:\n\n#### `logger.trace ( msg1, msg2, ... )`\nLogs the messsages using `trace` level.\n\n#### `logger.debug ( msg1, msg2, ... )`\nLogs the messsages using `debug` level.\n\n#### `logger.info ( msg1, msg2, ... )`\nLogs the messsages using `info` level.\n\n#### `logger.success ( msg1, msg2, ... )`\nLogs the messsages using `success` level.\n\n#### `logger.warn ( msg1, msg2, ... )`\nLogs the messsages using `warn` level.\n\n#### `logger.error ( msg1, msg2, ... )`\nLogs the messsages using `error` level.\n\n#### ℹ️ - About log parameters\n* The logger will ignore `null` parameters.\n* All other parameters will be converted to string, using `.toString ( )`.\n  * If, and only if, the result string is neither `null` nor `empty` it will be appended to the message, using a space character as separator.\n\n## Example output\nThe following code:\n``` JS\nconst logger = require ( \"../src/index.js\" ) ({\n\tlevel: \"trace\"\n});\n\nlogger.trace ( \"trace\", \"msg\" );\nlogger.debug ( \"debug\", \"msg\" );\nlogger.info ( \"info\", \"msg\" );\nlogger.success ( \"success\", \"msg\" );\nlogger.warn ( \"warn\", \"msg\" );\nlogger.error ( \"error\", \"msg\" );\n```\n\nWill produce the following output:\n\n![sample output](https://raw.githubusercontent.com/2bernes/js-logger/master/readme/images/output.png)\n","readmeFilename":"README.md"}