1.0.0 • Published 5 years ago
csf-tracer v1.0.0
The logging system for GalaxyCrowd Fund
Log Level
{
emerg: 0,
alert: 1,
crit: 2,
error: 3,
warning: 4,
notice: 5,
info: 6,
debug: 7,
}
How to use
tracer.<log level>(message, {Object});
Example
import tracer from 'csf-tracer'
tracer.info('info message', { info: 'some information' });
The log should be
{"level":"info","datetime":"2018-06-17T03:12:52.518Z","project":"csf","application":"tracer","environment":"production","message":"info message","info":"some information"}
Mask sensitive information
Tracer can mask sensentive infomation to avoid customer information leak by logs. The rules is defined by Regex
Default Rules
{
password: /.*/,
currentPassword: /.*/,
newPassword: /.*/,
account_number: /.*/,
token: /.*/,
otp: /.*/,
email: /.{1,4}?(?=@)/,
userEmail: /.{1,4}?(?=@)/,
};
How to customize rules
Set your own rules when initialize your app
tracer.strategy = {
password: /.*/,
bank_info: /.*/,
}
1.0.0
5 years ago