{"versions":{"1.1.0":{"module":"./esm/mod.js","main":"./script/mod.js","types":"./types/mod.d.ts","name":"@denodnt/logger","author":{"name":"zfx"},"license":"MIT","contributors":[{"name":"fuxing Zhang","email":"fuxing.zhang@qq.com","url":"https://github.com/fuxingZhang"},{"name":"Uriel Chemouni","email":"uchemouni@gmail.com","url":"https://uriel.ovh/"}],"description":"deno logger available for deno and NPM","keywords":["logger","deno"],"private":false,"homepage":"https://github.com/deno-library/logger","version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/deno-library/logger.git"},"bugs":{"url":"https://github.com/deno-library/logger/issues"},"exports":{".":{"import":{"types":"./types/mod.d.ts","default":"./esm/mod.js"},"require":{"types":"./types/mod.d.ts","default":"./script/mod.js"}}},"scripts":{"test":"node test_runner.js"},"dependencies":{"@deno/shim-deno":"~0.15.0"},"devDependencies":{"@types/node":"^18.11.9","chalk":"^4.1.2"},"gitHead":"2918b488f97598f9fc03e223d8798c8dd3671088","_id":"@denodnt/logger@1.1.0","_nodeVersion":"18.12.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-YQDu7BhvUYUJWgAXv8XzYgJhEdz8oXENTrVfKxy3P8o85pPS0YCnkhm20eReIq+08rVdMFKqyB7wJJNikTyv8g==","shasum":"2474ab26a35d8bdd4281d191a3301c17c02d510d","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@denodnt/logger/-/logger-1.1.0.tgz","fileCount":47,"unpackedSize":90490,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH3VuBF9rAEBJj8I4Z8f4iNJPjO0FuzZ1L91nDsn1If6AiEAkr5Rr128AMrphzBfrNHIUY7LurvxFnyz+K9GDViMFo0="}],"size":14824},"_npmUser":{"name":"anonymous","email":"uriel.chemouni@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"502545703@qq.com"},{"name":"anonymous","email":"uriel.chemouni@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_1.1.0_1684390617364_0.6842869344730236"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-18T06:16:57.607Z","publish_time":1684390617607,"_source_registry_name":"default"},"1.1.1":{"module":"./esm/mod.js","main":"./script/mod.js","types":"./types/mod.d.ts","name":"@denodnt/logger","author":{"name":"zfx"},"license":"MIT","contributors":[{"name":"fuxing Zhang","email":"fuxing.zhang@qq.com","url":"https://github.com/fuxingZhang"},{"name":"Uriel Chemouni","email":"uchemouni@gmail.com","url":"https://uriel.ovh/"}],"description":"deno logger available for deno and NPM","keywords":["logger","deno"],"private":false,"homepage":"https://github.com/deno-library/logger","version":"1.1.1","repository":{"type":"git","url":"git+https://github.com/deno-library/logger.git"},"bugs":{"url":"https://github.com/deno-library/logger/issues"},"exports":{".":{"import":{"types":"./types/mod.d.ts","default":"./esm/mod.js"},"require":{"types":"./types/mod.d.ts","default":"./script/mod.js"}}},"scripts":{"test":"node test_runner.js"},"dependencies":{"@deno/shim-deno":"~0.15.0"},"devDependencies":{"@types/node":"^18.11.9","chalk":"^4.1.2"},"gitHead":"a81c551abf1c1cb6009a27c41b842fdf2b6279e8","_id":"@denodnt/logger@1.1.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-YqwBvCkfSbq6huDQ72j/AAkGgZ0Ld2CIALtkZjLlXO73gOkBEyni904cii57clelTXvFczEnME+7MqQTK7Qrfg==","shasum":"b07e2e708049b1798d9aa047fe2130a6669d8c8d","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@denodnt/logger/-/logger-1.1.1.tgz","fileCount":47,"unpackedSize":91259,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFsrN2ffjqmlqw1Kfthv2lBB0UlcxuFJjwvYBsC9TwM7AiBJO6UFxL21sBKI+Ji23hEHWo7aSZWzagp0ehrlBI/P5w=="}],"size":15241},"_npmUser":{"name":"anonymous","email":"uriel.chemouni@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"502545703@qq.com"},{"name":"anonymous","email":"uriel.chemouni@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_1.1.1_1684487908294_0.35861915408856704"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-19T09:18:28.607Z","publish_time":1684487908607,"_source_registry_name":"default"},"1.1.2":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@denodnt/logger","author":{"name":"zfx"},"license":"MIT","funding":"https://github.com/deno-library/logger?sponsor=1","contributors":[{"name":"fuxing Zhang","email":"fuxing.zhang@qq.com","url":"https://github.com/fuxingZhang"},{"name":"Uriel Chemouni","email":"uchemouni@gmail.com","url":"https://uriel.ovh/"}],"description":"deno logger available for deno and NPM","keywords":["logger","deno","rotate"],"private":false,"homepage":"https://github.com/deno-library/logger","version":"1.1.2","repository":{"type":"git","url":"git+https://github.com/deno-library/logger.git"},"bugs":{"url":"https://github.com/deno-library/logger/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^20.2.5","picocolors":"^1.0.0"},"types":"./script/mod.d.ts","gitHead":"86fefd9e07c77ba578085711bcf61445b08950ea","_id":"@denodnt/logger@1.1.2","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-f/BZPJLCBLhkOqtKtkyPGS+WeL+3DOGLL8RbWNcnXB+XngZ0kpqy/jd6fGhfZc6J29xSyLp47OOq1TODCYzQkw==","shasum":"ebfff31157350b542674760513594303932ac501","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@denodnt/logger/-/logger-1.1.2.tgz","fileCount":73,"unpackedSize":126854,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHyI5H494w94SrsnGkLRY5x8sY6z7skNyNlETpIeDcxAIgV3R2Q7TMgf93OiptZAIIazeq08UQQQAbD5L8CSbs6Xg="}],"size":18126},"_npmUser":{"name":"anonymous","email":"uriel.chemouni@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"502545703@qq.com"},{"name":"anonymous","email":"uriel.chemouni@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_1.1.2_1685263804122_0.8535415587963111"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-28T08:50:04.319Z","publish_time":1685263804319,"_source_registry_name":"default"},"1.1.3":{"module":"./esm/mod.js","main":"./script/mod.js","name":"@denodnt/logger","author":{"name":"zfx"},"license":"MIT","funding":"https://github.com/deno-library/logger?sponsor=1","contributors":[{"name":"fuxing Zhang","email":"fuxing.zhang@qq.com","url":"https://github.com/fuxingZhang"},{"name":"Uriel Chemouni","email":"uchemouni@gmail.com","url":"https://uriel.ovh/"}],"description":"deno logger available for deno and NPM","keywords":["logger","deno","rotate"],"private":false,"homepage":"https://github.com/deno-library/logger","version":"1.1.3","repository":{"type":"git","url":"git+https://github.com/deno-library/logger.git"},"bugs":{"url":"https://github.com/deno-library/logger/issues"},"exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"dependencies":{"@deno/shim-deno":"~0.16.1"},"devDependencies":{"@types/node":"^20.9.0","picocolors":"^1.0.0"},"_id":"@denodnt/logger@1.1.3","gitHead":"b214f9cf54ea53945b6e5d415bb8e65af83e321b","types":"./script/mod.d.ts","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-n1SVrSjS0RkUP6X5LF+oDaL7SOHtujlG0PZXbzSZ1xgsnJXVpIeOpIiD9Osf/rJ2fP1Str4KHBTSFvRBy8Klgg==","shasum":"f375bff29fe720ae381290f5bc13dcfef28af0df","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@denodnt/logger/-/logger-1.1.3.tgz","fileCount":73,"unpackedSize":126923,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBQQDxhfiv6goRs4rMvEaAvrb3RdbZ+14xMRyCpZGuMMAiBAKc11ZJMdsJFyuw5bz6GJIbcSwDYJ02eta3u5r0MqUQ=="}],"size":18142},"_npmUser":{"name":"anonymous","email":"uriel.chemouni@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"502545703@qq.com"},{"name":"anonymous","email":"uriel.chemouni@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_1.1.3_1699530625627_0.031005239063410794"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-11-09T11:50:25.817Z","publish_time":1699530625817,"_source_registry_name":"default"},"1.1.4":{"name":"@denodnt/logger","version":"1.1.4","description":"deno logger available for deno and NPM","keywords":["logger","deno","rotate"],"author":{"name":"zfx"},"homepage":"https://github.com/deno-library/logger","repository":{"type":"git","url":"git+https://github.com/deno-library/logger.git"},"license":"MIT","bugs":{"url":"https://github.com/deno-library/logger/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"funding":"https://github.com/deno-library/logger?sponsor=1","contributors":[{"name":"fuxing Zhang","email":"fuxing.zhang@qq.com","url":"https://github.com/fuxingZhang"},{"name":"Uriel Chemouni","email":"uchemouni@gmail.com","url":"https://uriel.ovh/"}],"private":false,"dependencies":{"@deno/shim-deno":"~0.18.1"},"devDependencies":{"@types/node":"^20.11.10","picocolors":"^1.0.0"},"_id":"@denodnt/logger@1.1.4","gitHead":"29a25dcd49be5cbb95c417434ec0221b8ce68d69","types":"./script/mod.d.ts","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-X83qBTTVBBJjd14rphmT+IYVqspos5B7+u1QJL1EjK25Z+H+1NVjVN+Tcuf0qkQGlZ1iQaaTOowA+8mnFLATbA==","shasum":"12fd2f2446548e43d31ef7bbc5cc65073e55ea98","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@denodnt/logger/-/logger-1.1.4.tgz","fileCount":61,"unpackedSize":105562,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC7A3d2ltNuGBCPEGKjkvjs7zlT43crdvEbR5WJjR8D0AIhAM5QDZZ+/SHUs22BMbGlSyjlg7oGb8vOU9sIz/9EtzRE"}],"size":15831},"_npmUser":{"name":"anonymous","email":"uriel.chemouni@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"502545703@qq.com"},{"name":"anonymous","email":"uriel.chemouni@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_1.1.4_1706608967989_0.4727593776545702"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-01-30T10:02:48.224Z","publish_time":1706608968224,"_source_registry_name":"default"},"1.1.5":{"name":"@denodnt/logger","version":"1.1.5","description":"deno logger available for deno and NPM","keywords":["logger","deno","rotate"],"author":{"name":"zfx"},"homepage":"https://github.com/deno-library/logger","repository":{"type":"git","url":"git+https://github.com/deno-library/logger.git"},"license":"MIT","bugs":{"url":"https://github.com/deno-library/logger/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"funding":"https://github.com/deno-library/logger?sponsor=1","contributors":[{"name":"fuxing Zhang","email":"fuxing.zhang@qq.com","url":"https://github.com/fuxingZhang"},{"name":"Uriel Chemouni","email":"uchemouni@gmail.com","url":"https://uriel.ovh/"}],"private":false,"dependencies":{"@deno/shim-deno":"~0.19.0"},"devDependencies":{"@types/node":"^20.11.16","picocolors":"^1.0.0"},"_id":"@denodnt/logger@1.1.5","gitHead":"99984a292782421fca2e93b9ee729791c9de77f2","types":"./script/mod.d.ts","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-C78raqZ6XV0urCdzdbai6lp8d0h+NhtApqiV2Nw9jsyi2E35FNPMSxRgWEZGyUbwUMZ239CkFtYFu1y0QWfM8g==","shasum":"c15ece508dd1cd821b32c7989032ee680e44a0cf","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@denodnt/logger/-/logger-1.1.5.tgz","fileCount":61,"unpackedSize":105693,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE8FRQlgFvDlB5dq42z1mp8Qt6OtYxFWo93gqm60xoyLAiEA+4LwD/w0tkcUrUPMwUvqybh4HSCDD8ER68gtPoyKnBs="}],"size":15839},"_npmUser":{"name":"anonymous","email":"uriel.chemouni@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"502545703@qq.com"},{"name":"anonymous","email":"uriel.chemouni@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_1.1.5_1707290297782_0.9998099404543033"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-02-07T07:18:17.928Z","publish_time":1707290297928,"_source_registry_name":"default"},"1.1.6":{"name":"@denodnt/logger","version":"1.1.6","description":"deno logger available for deno and NPM","keywords":["logger","deno","rotate"],"author":{"name":"zfx"},"homepage":"https://github.com/deno-library/logger","repository":{"type":"git","url":"git+https://github.com/deno-library/logger.git"},"license":"MIT","bugs":{"url":"https://github.com/deno-library/logger/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"funding":"https://github.com/deno-library/logger?sponsor=1","contributors":[{"name":"fuxing Zhang","email":"fuxing.zhang@qq.com","url":"https://github.com/fuxingZhang"},{"name":"Uriel Chemouni","email":"uchemouni@gmail.com","url":"https://uriel.ovh/"}],"private":false,"dependencies":{"@deno/shim-deno":"~0.19.1"},"devDependencies":{"@types/node":"^20.12.12","picocolors":"^1.0.1"},"_id":"@denodnt/logger@1.1.6","gitHead":"7a0afeb0cdf3b8534484e50de1c16f8f97c548c1","types":"./script/mod.d.ts","_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-LOupHr6kTPti9Bp9OeUWCv/azv1jDQJ69z+gGGQL+Q+ZJrQXTotSsPRxlUjOMytGqS5FUXSJExg2gmF083nTMw==","shasum":"350fbf3867fd25527fe741d443adadaaf5aa71b6","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@denodnt/logger/-/logger-1.1.6.tgz","fileCount":169,"unpackedSize":213379,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEgFb+/m8AXFZrQ5ZjHRGSL4Agki4EKu0EV7uButhhuKAiAEpxysUMjJppUHocfeOlpfSfpM4P58pMAhk/rTDtj/YQ=="}],"size":29237},"_npmUser":{"name":"anonymous","email":"uriel.chemouni@gmail.com"},"directories":{},"maintainers":[{"name":"anonymous","email":"502545703@qq.com"},{"name":"anonymous","email":"uriel.chemouni@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/logger_1.1.6_1715953579224_0.6880626785373227"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-05-17T13:46:19.424Z","publish_time":1715953579424,"_source_registry_name":"default"}},"dist-tags":{"latest":"1.1.6"},"name":"@denodnt/logger","time":{"created":"2023-05-18T08:45:52.610Z","modified":"2024-05-18T09:52:13.827Z","1.1.0":"2023-05-18T06:16:57.607Z","1.1.1":"2023-05-19T09:18:28.607Z","1.1.2":"2023-05-28T08:50:04.319Z","1.1.3":"2023-11-09T11:50:25.817Z","1.1.4":"2024-01-30T10:02:48.224Z","1.1.5":"2024-02-07T07:18:17.928Z","1.1.6":"2024-05-17T13:46:19.424Z"},"readme":"# deno-logger\n\n[![NPM Version](https://img.shields.io/npm/v/@denodnt/logger.svg?style=flat)](https://www.npmjs.org/package/@denodnt/logger)\n[![JSR Version](https://jsr.io/badges/@deno-lib/logger)](https://jsr.io/@deno-lib/logger)\n\nDeno / NodeJS colorful logger colorful logger\n\nFor Deno usage refer to [deno-logger doc](https://deno.land/x/logger)\n\n## Useage\n\n### console logger\n\n```js\nimport Logger from \"@denodnt/logger\";\n\nconst logger = new Logger();\n\nlogger.info(\"i am from consoleLogger\", { name: \"zfx\" });\nlogger.warn(\"i am from consoleLogger\", 1, \"any\");\nlogger.error(\"i am from consoleLogger\", new Error(\"test\"));\n```\n\n### file and console logger\n\n```js\nimport Logger from \"@denodnt/logger\";\n\nconst logger = new Logger();\n\n// console only\nlogger.info(\"i am from consoleLogger\", { name: \"zfx\" });\nlogger.warn(\"i am from consoleLogger\", 1, \"any\");\nlogger.error(\"i am from consoleLogger\", new Error(\"test\"));\n\nawait logger.initFileLogger(\"../log\");\n\n// file and console\nlogger.info(\"i am from fileLogger\", { name: \"zfx\" });\nlogger.warn(\"i am from fileLogger\", 1, \"any\");\nlogger.error(\"i am from fileLogger\", new Error(\"test\"));\n```\n\n### file logger only\n\n```js\nimport Logger from \"@denodnt/logger\";\n\nconst logger = new Logger();\nawait logger.initFileLogger(\"../log\");\nlogger.disableConsole();\n\n// file only\nlogger.info([\"i am from fileLogger\", 1], { name: \"zfx\" });\n```\n\n### file logger optional parameter\n\ninterface\n\n```ts\ninterface fileLoggerOptions {\n  rotate?: boolean; // cut by day\n  maxBytes?: number;\n  // Only available if maxBytes is provided, Otherwise you will get an error\n  maxBackupCount?: number;\n}\n```\n\nexample\n\n```js\nimport Logger from \"@denodnt/logger\";\nconst logger = new Logger();\n\n// cut by day\n// filename is [date]_[type].log\n// example 2020-05-25_warn.log, 2020-05-25_info.log, 2020-05-25_error.log\nawait logger.initFileLogger(\"../log\", {\n  rotate: true,\n});\n\n// maxBytes\n// filename is [type].log.[timestamp]\n// example: info.log.1590374415956\nawait logger.initFileLogger(\"../log\", {\n  maxBytes: 10 * 1024,\n});\n\n// rotate and maxBytes\n// filename is [date]_[type].log.[timestamp]\n// example: 2020-05-25_info.log.1590374415956\nawait logger.initFileLogger(\"../log\", {\n  rotate: true,\n  maxBytes: 10 * 1024,\n});\n\n// maxBytes and maxBackupCount\n// filename is [type].log.[n]\n// example info.log.1, info.log.2 ...\n// when reach maxBackupCount, the [type].log.[maxBackupCount-1] will be overwrite\n//  detail:\n// `maxBytes` specifies the maximum size\n// in bytes that the log file can grow to before rolling over to a new one. If the\n// size of the new log message plus the current log file size exceeds `maxBytes`\n// then a roll over is triggered. When a roll over occurs, before the log message\n// is written, the log file is renamed and appended with `.1`. If a `.1` version\n// already existed, it would have been renamed `.2` first and so on. The maximum\n// number of log files to keep is specified by `maxBackupCount`. After the renames\n// are complete the log message is written to the original, now blank, file.\n//\n// Example: Given `log.txt`, `log.txt.1`, `log.txt.2` and `log.txt.3`, a\n// `maxBackupCount` of 3 and a new log message which would cause `log.txt` to\n// exceed `maxBytes`, then `log.txt.2` would be renamed to `log.txt.3` (thereby\n// discarding the original contents of `log.txt.3` since 3 is the maximum number of\n// backups to keep), `log.txt.1` would be renamed to `log.txt.2`, `log.txt` would\n// be renamed to `log.txt.1` and finally `log.txt` would be created from scratch\n// where the new log message would be written.\nawait logger.initFileLogger(\"../log\", {\n  maxBytes: 10 * 1024,\n  maxBackupCount: 10,\n});\n\n// rotate and maxBytes and maxBackupCount\n// filename is [date]_[type].log.[n]\n// example 2020-05-25_info.log.1, 2020-05-25_info.log.2\n// when reach maxBackupCount, the [type].log.[maxBackupCount-1] will be overwrite\nawait logger.initFileLogger(\"../log\", {\n  rotate: true,\n  maxBytes: 10 * 1024,\n  maxBackupCount: 10,\n});\n\n// rotate and maxBackupCount\n// maxBackupCount will be ignored\nawait logger.initFileLogger(\"../log\", {\n  rotate: true,\n  maxBackupCount: 10,\n});\n```\n\nThe following conditions will throw an error\n\n```ts\n// maxBackupCount\n// get error => maxBackupCount must work with maxBytes\nawait logger.initFileLogger(\"../log\", {\n  maxBackupCount: 10,\n});\n// rotate and maxBackupCount\n// get error => maxBackupCount must work with maxBytes\nawait logger.initFileLogger(\"../log\", {\n  rotate: true,\n  maxBackupCount: 10,\n});\n```\n\n## disableConsole and enableConsole\n\n```js\nimport Logger from \"@denodnt/logger\";\n\nconst logger = new Logger();\n\n// console\nlogger.info(\"console enabled, you can see me\");\nlogger.disableConsole();\n// no message is logged\nlogger.info(\"console disabled\");\nlogger.enableConsole();\n// console\nlogger.info(\"console enabled, you can see me\");\n```\n\n## disableFile and enableFile\n\n```js\nimport Logger from \"@denodnt/logger\";\n\nconst logger = new Logger();\nawait logger.initFileLogger(\"../log\");\n\nlogger.disableFile();\n// not log to file\nlogger.info(\"file disbaled\");\nlogger.enableFile();\n// log to file\nlogger.info(\"file enabled, you can see me\");\n```\n\n## disable and enable\n\n- disable disable write to file and terminal, don't care if it is currently\n  writing to a file or terminal, but hope to restore the currently configuration\n  later\n- enable restore previous log configuration: file, terminal or both\n\nexample:\n\n1. fileLogger => disable => enable => fileLogger\n2. consoleLogger => disable => enable => consoleLogger\n3. fileLogger, consoleLogger => disable => enable => fileLogger, consoleLogger\n\n```js\nimport Logger from \"@denodnt/logger\";\n\nconst logger = new Logger();\nawait logger.initFileLogger(\"../log\");\n\nlogger.disable();\nlogger.enable();\n```\n\n## test\n\n```bash\ndeno test --allow-read --allow-write\n```\n\n## Dual-Stack / Triple-Stack integration\n\nA dual-stack project is generaly a npm project that can be import as commonJS\nmodule or as ESM module; So if a project can also be import as a Deno module,\nit's a triple-stack one.\n\nTo convert your Deno project to a dual-stack npm project, you should use\n[deno/dnt](https://deno.land/x/dnt), then create a `_build_npm.ts` or\n`scripts/build_npm.ts` that looks like:\n\n```ts\nimport { build, emptyDir } from \"@deno/dnt\";\n\n// grap the next version number as you want\nconst version: Deno.args[0];\nawait emptyDir(\"./npm\");\nawait build({\n  entryPoints: [\"./mod.ts\"],\n  outDir: \"./npm\",\n  shims: {\n    deno: true,\n  },\n  compilerOptions: {\n    lib: [\"dom\", \"esnext\"],\n  },\n  package: {\n    name: \"pkg-name\",\n    version: version,\n    // ... package stuff\n  },\n  // map your favorite deno logger to its npm port.\n  mappings: {\n    \"@denodnt/logger\": {\n      name: \"@denodnt/logger\",\n      version: \"1.1.6\",\n      peerDependency: false,\n    },\n  },\n});\n```\n\n## Screenshots\n\nconsoleLogger\\\n![consoleLogger](https://github.com/deno-library/logger/blob/master/screenshots/consoleLogger.png)\n\nfileLogger\\\n![fileLogger](https://github.com/deno-library/logger/blob/master/screenshots/fileLogger.png)\n\ncut logs by day\\\n![CutByDay](https://github.com/deno-library/logger/blob/master/screenshots/fileLogger.rotate.png)\n\nMore screenshots in the `screenshots` folder.\n\n## Logger interface\n\n```ts\ninterface fileLoggerOptions {\n  rotate?: boolean;  // cut by day\n  maxBytes?: number, // the maximum size in bytes that the log file can grow to before rolling over to a new one\n  maxBackupCount?: number // maxBackupCount must work with maxBytes\n}\n\ninterface LoggerInerface {\n  constructor()\n\n  info(...args: unknown[]): void\n  warn(...args: unknown[]): void\n  error(...args: unknown[]): void\n\n  async initFileLogger(dir: string, options: fileLoggerOptions = {}): Promise<void>\n\n  disableConsole(): void\n  enableConsole(): void\n\n  disableFile(): void;\n  enableFile(): void;\n\n  disable(): void;\n  enable(): void;\n}\n```","users":{}}