Giter Site home page Giter Site logo

winston-daily-logger-node's Introduction

winston daily logger

This is a customization of winston logger which does the following:

  • Creates log files daily app-logs-20-10-2018.log

  • Uploads the old log files to S3 for archival.

  • Deletes old log files weekly from disk.

How to use?

  • Install all the required packages listed in package.json.
npm install --save winston;
npm install --save winston-daily-rotate-file;
npm install --save json-stringify-safe;
npm install --save dotenv;
npm install --save aws-sdk;
  • Copy the utils, config and logs folder to your project root.

  • Create a .env file with all the values as listed in .env.example.

  • In your app.js/index.js/main.js file, add these lines to configure root folder and load .env file

global.__basedir = __dirname; // set root directory
require('dotenv').config(); // load .env file
  • Now, just require the logger anywhere you want to use it.
const logger = require('./config/logger/index');

logger.error("error");
logger.warn("warning");
logger.info("info");
logger.debug("debug");

Feel free to raise issues if something doesn't works out for you.

You can reach me out at https://twitter.com/vabhishek_me

As an addition, if you would like to contribute, checkout the gzip-logs branch. On this branch, I'm trying to gzip the log files and upload the .gz files to s3 and delete them as soon as they are uploaded. Its a work in progress.

winston-daily-logger-node's People

Contributors

vabhishek-me avatar

Stargazers

Roman avatar

Watchers

James Cloos 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.