1.1.21 • Published 5 years ago

the-simple-log v1.1.21

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

simple-log: a cloud-based log for node

simple-log is the simple way to do logging on node. Debug your application from anywhere, whether it's running locally, in a docker container, or in a VPS in the cloud.

Table of Contents

Installation

npm install -S simple-log

Requirements

You need to create an API Key and a Project on https://app.thesimplelog.com/

Usage

After setting up the simple object:

const options = { apiKey: 'your.api.key.here', projectName: 'My App' };
const simple = require('simple-log')(options);

You can call simple.log or one of the convenience functions (simple.debug, simple.info, simple.warn, simple.error, simple.fatal)

Examples

Logging 101

'use strict';

const options = { apiKey: 'your.api.key.here', project: 'My App' };
const simple = require('simple-log')(options);

// since we're using simple.log, we have to pass the logging level ('info') ourselves
simple.log('info', 'Started application'); 

// helper functions perform the same action as simple.log('LEVEL', 'message')
simple.info('Initializing modules...');
simple.debug('Starting MySQL');
simple.debug('Starting Redis');

Options

There are a number of options that can be set while initializing the simple object:

  • apiKey (required) - obtain via https://app.thesimplelog.com/
  • project (required) - obtain via https://app.thesimplelog.com/
  • transports (optional) - default value: ["simple-api", "console"], allowable values: ["simple-api", "console"]
  • consoleFormat (optional) - default value: d h (i): m, allowable values can be seen here

Transports

There are two available transports, both are enabled by default:

  • simple-api - logs to The Simple App API
  • console - logs locally to stdout, just like console.log

Output Formats

When logging to the console (using the console transport option and setting consoleFormat), you can specify the preferred format from the following options:

  • f: filename
  • l: line number
  • h: hostname
  • i: internal ip
  • e: external ip
  • d: date
  • m: message
1.1.21

5 years ago

1.1.20

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago