Socket
Socket
Sign inDemoInstall

@allegiant/logfile

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @allegiant/logfile

Simple logfile library.


Version published
Weekly downloads
4
increased by300%
Maintainers
1
Install size
6.94 kB
Created
Weekly downloads
 

Readme

Source

logfile

Simple logfile library. Provides a simple, effective way to log stdout and stderr to a file of your choice.

There be 🐲 here! The API and functionality are being cemented, anything before a 1.0.0 release is subject to change.

const path = require('path');
const LogFile = require('../index').LogFile;

var live = false;
var logger = new LogFile( path.resolve('logfile.txt'));

require('@allegiant/shutdown')(onShutdown);
function onShutdown(req=false, finished) {
    console.log("Shut down triggered... ", req); // eslint-disable-line
    if (live !== false)
        clearInterval(live);
    
    if (logger !== false) {
        console.log("Closing log..."); // eslint-disable-line
        logger.on('finish', function() {
            console.log("Logging completed"); // eslint-disable-line
            finished();
        });
        // flushes data to the log file and emits finish event
        logger.end();
    } else {
        finished();
    }
}

live = setInterval(function () {
    console.log("tick"); // eslint-disable-line
}, 1000); 

console.log("Started"); // eslint-disable-line

Copyright © 2017 Allegiant. Distributed under the terms of the MIT License, see LICENSE

Availble via npm or github.

FAQs

Last updated on 28 Dec 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc