0.5.15 • Published 3 years ago

vv-logger-tiny v0.5.15

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

Install & Use

npm i vv-logger-tiny
const logger = require('vv-logger-tiny').create(__dirname)
// or
// const logger = require('./index.js').create(__dirname, {level: 'trace', file_name_mask: 'app_${yyyymmdd}.log', days_life: 4, write_to_console: true})
// warning!!! in file_name_mask supported only one date mask - ${yyyymmdd}!!!

logger.trace('hello, trace!')
logger.debug('hello, debug!')
logger.error('hello, error!')
logger.error(new Error('hello, error!'))
logger.debug('user {0} delete document #{1}', {replace: ['Mark', '42']})
logger.error('error when user {0} delete document #{1}', {replace: ['Mark', '42'], traces: new Error('some error')})

Classes

Typedefs

App

Kind: global class

new App(path, options)

ParamTypeDescription
pathstringwhere store log files, default = __dirname
optionsconstructor_optionsadditional options

app._env : _partial.type_env

Kind: instance property of App

app.get_path() ⇒ string

Kind: instance method of App

app.set_option_days_life(days_life)

Kind: instance method of App

ParamType
days_lifenumber

app.set_option_write_to_console(write_to_console)

Kind: instance method of App

ParamType
write_to_consoleboolean

app.set_option_level(level)

Kind: instance method of App

ParamType
leveltype_log_level

app.trace(message, options)

Kind: instance method of App

ParamType
messagestring
optionsmessage_options

app.debug(message, options)

Kind: instance method of App

ParamType
messagestring
optionsmessage_options

app.error(message, options)

Kind: instance method of App

ParamType
messagestring | Error
optionsmessage_options

app.save_to_file_force(callback)

Kind: instance method of App

ParamType
callbackcallback_error

type_log_level : 'trace' | 'debug' | 'error'

logger level, default = 'debug'. if = 'trace', log work with 'trace','debug','error', if = 'debug' - 'debug','error', if 'error' - only 'error'

Kind: global typedef

constructor_options

logger options

Kind: global typedef
Properties

NameTypeDescription
file_name_maskstringmask file name for store logger, default = 'app_${yyyymmdd}.log', where '${yyyymmdd}' - date write log. if mask without '${yyyymmdd}', delete old log files not working
days_lifenumbernumber of days for which log files will be stored, default = 4, only current date = 1, disable delete old log files = 0. you can change it in an already created class in method set_option_days_life
write_to_consolebooleanwrite log to file and console (true) or in file only (false), default = true. you can change it in an already created class in method set_option_write_to_console
leveltype_log_levellogger level, default = 'debug'. if = 'trace', log work with 'trace','debug','error', if = 'debug' - 'debug','error', if 'error' - only 'error'. you can change it in an already created class in method set_option_level

message_options

message options

Kind: global typedef
Properties

NameTypeDescription
replacestring | Array.<string>for example: message = 'step #{0} where {1}', replace = 4, 'i create new file', text result = 'step #4 where i create new file'
tracesstring | Error | Array.<string> | Array.<Error>big attachment to message, for example - error with full stack

callback_error : function

Kind: global typedef

ParamType
errorError
0.5.14

3 years ago

0.5.15

3 years ago

0.5.13

3 years ago

0.5.12

4 years ago

0.5.11

4 years ago

0.5.10

4 years ago

0.5.9

4 years ago

0.5.8

4 years ago

0.5.7

4 years ago

0.5.6

4 years ago

0.5.5

4 years ago

0.5.4

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago