{"name":"@midwayjs/logger","version":"3.0.0-beta.15","keywords":["midway","logger"],"license":"MIT","_id":"@midwayjs/logger@3.0.0-beta.15","maintainers":[{"name":"mariodu","email":"dujiakun@gmail.com"},{"name":"czy88840616","email":"czy88840616@gmail.com"},{"name":"legendecas","email":"legendecas@gmail.com"},{"name":"echosoar","email":"82163514@qq.com"},{"name":"lellansin","email":"lellansin@gmail.com"},{"name":"lxxyx","email":"Lxxyxzj@gmail.com"},{"name":"stone-jin","email":"1520006273@qq.com"}],"homepage":"https://github.com/midwayjs/logger#readme","bugs":{"url":"https://github.com/midwayjs/logger/issues"},"dist":{"shasum":"7ca238a6c41329ff2895f1d854e66619eac760fa","tarball":"http://registry-npm.ywwl.com/@midwayjs/logger/download/@midwayjs/logger-3.0.0-beta.15.tgz","fileCount":27,"integrity":"sha512-+ifHtxj3TMIcw27kv9Dx3S8lGWHMm61tEQJOJ3tpJBoM7+vh91NhGm98lUqqTlZLBPPWBKc+5zN4uz2ObDHDSA==","signatures":[{"sig":"MEUCIQDN/LKxRJAcCTsmVKgTGMWISi3XiMXi9V6tb/Lc8ywc9AIgGqDHwuYUZBoCYn2IhHJtGBh8boAG16pKEY3f9UgyKLA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":100803,"size":23301,"noattachment":false,"key":"/@midwayjs/logger/-/@midwayjs/logger-3.0.0-beta.15.tgz"},"main":"dist/index","readme":"# @midwayjs/logger\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/midwayjs/midway/pulls)\n\n@midwayjs/logger is a log module extended based on winston, which is suitable for log output under a single process, and supports multiple formats and customizations.\n\n## Install\n\n```bash\n$ npm install @midwayjs/logger --save\n```\n\n## Create Logger\n\n```ts\nimport { loggers } from '@midwayjs/logger';\n\nconst logger = loggers.createLogger('logger', {\n  // some logger options\n})\n```\n\nCreate logger with console and file transports.\n\n```typescript\nimport { loggers, ConsoleTransport, FileTransport } from '@midwayjs/logger';\n\nconst logger = loggers.createLogger('logger', {\n  transports: {\n    console: new ConsoleTransport(),\n    file: new FileTransport({\n      dir: '...',\n      fileLogName: 'app.log',\n    }),\n  }\n})\n```\n\nCreate console logger(just disable file and error transports)\n\n```typescript\nconst logger = loggers.createLogger('consoleLogger', {\n  enableFile: false,\n  enableError: false,\n})\n```\n\n\n## Logger Output Method\n\n```ts\nlogger.debug('debug info');\nlogger.info('启动耗时 %d ms', Date.now() - start);\nlogger.warn('warning!');\nlogger.error(new Error('my error'));\nlogger.write('abcde);\n```\n\n## Logger Level\n\nlog level is divided into the following categories, and the log level decreases sequentially (the larger the number, the lower the level):\n\n```ts\nconst levels = {\n  none: 0,\n  error: 1,\n  trace: 2,\n  warn: 3,\n  info: 4,\n  verbose: 5,\n  debug: 6,\n  silly: 7,\n  all: 8,\n}\n```\n\nSet level for all transports\n\n```typescript\nconst logger = loggers.createLogger('logger', {\n  // ...\n  level: 'warn',\n});\n\n// not output\nlogger.debug('debug info');\n\n// not output\nlogger.info('debug info');\n```\n\n## Format\n\nChange file and error logger format.\n\n```typescript\nconst logger = loggers.createLogger('logger', {\n  // ...\n  format: info => {\n    return `${info.timestamp} ${info.message}`;\n  }\n});\n```\n\ninfo is a default metadata, include some properties.\n\n\n## Logger Options\n\nfind more options in [interface](https://github.com/midwayjs/logger/blob/main/src/interface.ts).\n\n\n## License\n\n[MIT]((http://github.com/midwayjs/logger/blob/master/LICENSE))\n","engines":{"node":">=10"},"gitHead":"f0f3bb3483af5b408e63558cada6b66846d59349","scripts":{"cov":"jest --runInBand --coverage --forceExit","lint":"mwts check","test":"jest --runInBand","build":"rm -rf dist && tsc","lint:fix":"mwts fix"},"typings":"dist/index.d.ts","_npmUser":{"name":"czy88840616","email":"czy88840616@gmail.com"},"repository":{"url":"git+ssh://git@github.com/midwayjs/logger.git","type":"git"},"_npmVersion":"8.19.2","description":"midway logger sdk","directories":{},"_nodeVersion":"18.12.1","dependencies":{"dayjs":"^1.10.7"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"29","mwts":"1.3.0","threads":"1.7.0","ts-jest":"29","ts-node":"10.9.1","fs-extra":"10.1.0","cross-env":"7.0.3","typescript":"5.2.2","@types/jest":"29","@types/node":"18.14.2"},"_npmOperationalInternal":{"tmp":"tmp/logger_3.0.0-beta.15_1697215153273_0.6677284129873513","host":"s3://npm-registry-packages"},"publish_time":1697215153512,"_cnpm_publish_time":1697215153512,"dist-tags":{"alinode-stable":"3.0.0-alpha.42","alpha":"3.0.0-alpha.43","beta":"4.0.0","latest":"4.1.0"}}