New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cw-logger

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cw-logger

log4js

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

cw logger sample

cd sample
node test.js

How to use

Install

To install via npm, https://www.npmjs.com/package/cw-logger, http://npm.ciwong.com/#/detail/cw-logger

npm install cw-logger --save

Using

const config = {
	logRoot: require('path').resolve(__dirname, './logs'), // 日志根目录(需根据实际情况设置)
	logLevel: 'trace', // file
	logLevel4console: 'trace', // console
	enableBunyan: true, // 默认启用bunyan; 设置为false则使用log4; 不推荐使用log4, 在下个版本将取消兼容
	bunyan: {
		// 级别分别是: TRACE DEBUG INFO WARN ERROR FATAL
		categorys: [{
				name: 'console',
				type: 'console'
			},{
				name: 'app', // 模块/分类
				type: 'rotatingFile',
				rotateConfig: {
					period: '1d', // The period at which to rotate.
					totalFiles: 15 //The maximum number of rotated files to keep. 0 to keep files regardless of how many there are.
				}
			},{
				name: 'login', // 模块/分类
				type: 'rotatingFile',
				rotateConfig: {
					period: '1d', // The period at which to rotate.
					totalFiles: 0 //The maximum number of rotated files to keep. 0 to keep files regardless of how many there are.
				}
			}
		]
	}
};
const log = require('cw-logger')(config);
const myConsoleLogger = log.console;
const loginLogger = log.login;
const appLogger = log.app;

myConsoleLogger.info('info');
loginLogger.info('info');
appLogger.info('info');

myConsoleLogger.error('error');
loginLogger.error('error');
appLogger.error('error');

Keywords

FAQs

Package last updated on 16 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc