1.0.38 • Published 1 year ago

@infini-dev/logger v1.0.38

Weekly downloads
-
License
Unlicense
Repository
github
Last release
1 year ago

Getting Started

Micro logger with levels. Default output is console. Easy to integrate external sources.

Common use case
Anything. For example, we use it to output data on external source like Sentry or Logrocket.

Install

Run of one these command to install.

npm i @infini-dev/logger

or

yarn add @infini-dev/logger

Examples

Default

Output all level.

import {logger} from '@infini-dev/logger'
const {error} = logger()

const saveDocument = (path: string, changes: string) => {
        // ... Implementation

   error("Failed to save..")

    // ... Implementation
}

Debug Log Level

Output debug level.

import {logger} from '@infini-dev/logger'
const {error} = logger({level: "debug"})

const saveDocument = (path: string, changes: string) => {
        // ... Implementation

   error("Failed to save..")

    // ... Implementation
}

External Log

Sends logs to external.

import {logger} from '@infini-dev/logger'

const externalLog = () => {
  //send logs to externalsystem
  }

const myAdapter: ILogger = {
  debug: externalLog,
  info:  externalLog,
  warn:  externalLog,
  error:  externalLog,
  log:  externalLog
};

const {error} = logger({logger: myAdapter})

const saveDocument = (path: string, changes: string) => {
        // ... Implementation

   error("Failed to save..")

    // ... Implementation
}

Powered 🚀 by Infinisoft Inc.

Wanna code the future? Come with us https://www.infinisoft.world