Socket
Socket
Sign inDemoInstall

onelogger

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onelogger

the only ONE logger


Version published
Weekly downloads
9.8K
increased by1.6%
Maintainers
1
Weekly downloads
 
Created
Source

onelogger

The only ONE logger.

Install

npm i onelogger

Usage

Get logger

import { getLogger, getCoreLogger } from 'onelogger';

const logger = getLogger();
logger.info('hello world');
// => hello world

// get logger with prefix label
const loggerWithPrefix = getLogger('my-prefix-name1');
loggerWithPrefix.info('hello world');
// => [my-prefix-name1] hello world

// get coreLogger
const coreLogger = getCoreLogger('my-prefix-name2');
coreLogger.info('hello world on core logger');
// => hello world on core logger

// get coreLogger with prefix label
const coreLoggerWithPrefix = getCoreLogger('my-prefix-name2');
coreLoggerWithPrefix.info('hello world on core logger');
// => [my-prefix-name2] hello world on core logger

Set custom logger

The default logger and coreLogger will pipe to global.console, you can change them to your real logger. The custom logger must implements ILogger interface.

import { setLogger, setCoreLogger, setCustomLogger } from 'onelogger';

setLogger(customLogger);
setCoreLogger(customCoreLogger);
setCustomLogger('myBizLogger', myBizLogger);
getCustomLogger('myBizLogger');

License

MIT

Contributors


fengmk2

This project follows the git-contributor spec, auto updated at Sat Jan 20 2024 22:39:14 GMT+0800.

Keywords

FAQs

Package last updated on 20 Jan 2024

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