Package Exports
- the-simple-log
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (the-simple-log) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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', projectName: 'My App' };
const simple = require('simple-log')(options);
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/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 APIconsole
- logs locally tostdout
, just likeconsole.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