Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

logobj

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logobj

Object to File Logger for Node

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by500%
Maintainers
1
Weekly downloads
 
Created
Source

logobj

Build Status Dependency Status Code Climate

Object to File Logger for Node

Install

npm install logobj

Usage

logobj([<filename>,] <data> [, <options>]);

var logobj = require('logobj');
// ...
logobj(data);
// or
logobj('myfile.json', data);
// or
logobj('myfile.json', data, options);

Parameters

filename (optional)

  • Name of file to write data to.
  • Date/time will be appended to the name before the extension. (Can be disabled - see options below)
  • If not specified then a UUID will be used with the dashes removed and '.json' appended.

data

  • The data that you want to write to the file.
  • If it's not an object then it will be encapsulated inside an object.
  • The data will be pretty printed (also called beautified or beautification).

options (optional)

The default options are show below with comments.

{
  // The filename options determine how the filename is created
  filename: {
    // Change to true to suppress adding a date/time stamp to the filename
    nodate: false,
    // Change the date/time format in the filename
    dateFormat: 'YYYYMMDDhhmmss',
    // Prepend the date instead of appending when true
    leadDate: false,
    // Append .json if file doesn't end in .json
    appendJson: false
  },
  // indent and serializer are used by the JSON.stringify() method
  // Number of characters to use for indenting
  indent: 2,
  // Serializer that should be used by JSON.stringify()
  serializer: null,
  // fs.writeFile() is used to write the file.
  // Pass any options that fs.writeFile() accepts in this object.
  fsOptions: {
    encoding: 'utf8'
  }
}

Keywords

FAQs

Package last updated on 25 Jul 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc