Git Product home page Git Product logo

winston-log-factory's Introduction

winston-log-factory

winston-log-factory é uma biblioteca para facilitar a criação de logger de aplicação usando winston-js e elk

Instalação

npm install --save winston-log-factory

Uso

import { LoggerFactory } from "winston-log-factory";

const options = {
  level: "info",
  color: true,
  defaultMeta: { foo: "bar" },
  serviceName: "my-service",
  serviceVersion: "v1.0.0",
  elk: { config: { node: "http://localhost:9200" }, level: "info" },
  formats: [ expressMessageFormat() ]
};

const logger = LoggerFactory.init(options);

logger.info("qualquer coisa", { test: "params" });
logger.error("erro", new Error("error"));
logger.debug("variavel.x", variavel.x);
logger.warn("warning", { teste: 123 });
logger.log("info", "teste", { aaa: "bbb" });

Parâmetros disponíveis

Parametro Tipo Valor padrão Observação
options.level string 'info' Nivel máximo para logging no stdout
options.color boolean false Definir se o output do stdout será colorizado ou não
options.defaultMeta object {} Objeto com informações que serão incluídas em todos os logs
options.serviceName string - Nome do serviço onde o logger será utilizado
options.serviceVersion string - Versão do serviço onde o logger será utilizado
options.elk object - Configurações para logging no ELK
options.elk.level string 'info' Nivel máximo para logging no ELK
options.elk.config object - Configurações do cliente do ELK
options.formats array [shortMessageFormat()] Formatadores de saída do winston

winston-log-factory's People

Contributors

igoventura avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.