cb-winston-loki-logger

1.3.9 • Public • Published

Description

This is a simple logger which sends logs using Winston and Morgan to Grafana Loki.

Installation

npm i cb-winston-loki-logger

Usage

Insert the unique label of the logged app and the HTTP address where Loki is hosted. Default address of Loki on localhost is http://localhost:3100.

const lokiAddress = "http://localhost:3100";
const label = "app_test1";

const WinstonLokiLogger = require('cb-winston-loki-logger');
const LoggerClass = new WinstonLokiLogger();
const logger = LoggerClass.createLogger(label, lokiAddress);

Available functions of this logger: info(), warn(), and error(). Additional parameters can be added for function error() and warn() like objects or arrays.

logger.info("Server is running on localhost:8080");
logger.warn("This function is deprecated");
logger.error("Internal server error", args);

Test

npm i
npm test

Package Sidebar

Install

npm i cb-winston-loki-logger

Weekly Downloads

1

Version

1.3.9

License

ISC

Unpacked Size

10.3 kB

Total Files

6

Last publish

Collaborators

  • astridariani