Socket
Socket
Sign inDemoInstall

@invilite/logger

Package Overview
Dependencies
7
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @invilite/logger

[![Codacy Badge](https://app.codacy.com/project/badge/Grade/9bdbdeea92924bc0b77589082022560c)](https://www.codacy.com/gh/Invilite/logger/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Invilite/logger&utm_campaign=Badge_Grade)


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@invilite/logger

Codacy Badge Maintainability Known Vulnerabilities Version License

Simple but powerful logger using RFC-5424, compatible with Syslog.

Highlights

  • Focus on high performance
  • TypeScript type definitions included

Install

This is a Node.js module available through the npm registry.

Using npm:

$ npm install @invilite/logger

Using bower:

$ bower install @invilite/logger

Using yarn:

$ yarn add @invilite/logger

Usage

import {Logger, LogLevel, LogFormat} from "@invilite/logger";
import {Console} from "@invilite/Transports";

const logger = new Logger();
logger.addTransport(new Console(LogLevel.debug, LogFormat.FORMAT_COLOR));

logger.trace("This is long trace message, used to trace errors", process.argv);
logger.debug("Example debug log, debug is:", false);
logger.info("Example info content.");

Methods

addTransport()

Register new transport.

Syntax
addTransport(transport: AbstractTransport): Logger;
Example
const logger = new Logger();
logger.addTransport(new Console(LogLevel.debug, LogFormat.FORMAT_COLOR));

setTransports()

Replace all transports.

Syntax
setTransports(transports: AbstractTransport[]): Logger;
Example
const logger = new Logger();
logger.setTransports([
    new Console(LogLevel.debug, LogFormat.FORMAT_COLOR)
]);

setTimeFormat()

Set time format, in format used by @invilite/date@format().

Syntax
setTimeFormat(format: string): Logger;

getTimeFormat()

Get current time format.

Syntax
getTimeFormat(): string;

License

Library is licensed under a GNU General Public License v3.0

FAQs

Last updated on 29 Dec 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc