Skip to content

Logflare/winston-logflare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

winston-logflare

This module provides a transport for winston logger that forwards messages to Logflare app.

Installation

$ npm install winston-logflare

Usage example

const winston = require("winston")
const LogflareTransport = require("winston-logflare")

const apiKey = "..."
const sourceToken = "..."

const logger = winston.createLogger({
    level: "info",
    format: winston.format.json(),
    defaultMeta: {env: "staging"},
    transports: [
        new LogflareTransport({
            apiKey,
            sourceToken,
            batchMaxSize: 1, // optional config setting
            batchFlushInterval: 1000, // optional config setting
        }),
    ],
})

logger.log("info", "info message", {property: "value"})
logger.log("error", "Error occured!")

License

Licensed under MIT.