viva-logger v2.0.7
Classes
Functions
Typedefs
Logger
(license MIT) text logger, full example - see example.js
Kind: global class
- Logger
- .path
- .path_trace
- .pipe_unnamed
- .pipe_list
- .write_to_file
- .write_to_file
- .init([path], [write_to_file], [write_to_console]) ⇒ string
- .turnOn([pipe], [log_this_command])
- .turnOff([pipe], [log_this_command])
- .debug(message, [pipe], [trace_objects], [additional_param]) ⇒ type_write_result
- .error(error, [pipe], [trace_objects], [additional_param]) ⇒ type_write_result
logger.path
{string}
Kind: instance property of Logger
logger.path_trace
{string}
Kind: instance property of Logger
logger.pipe_unnamed
{boolean}
Kind: instance property of Logger
logger.pipe_list
{string[]}
Kind: instance property of Logger
logger.write_to_file
{boolean}
Kind: instance property of Logger
logger.write_to_file
{boolean}
Kind: instance property of Logger
logger.init(path, write_to_file, write_to_console) ⇒ string
initialization logger, set root path for storage text log files
Kind: instance method of Logger
Returns: string - full path name for storage text log files
Param | Type | Description |
---|---|---|
path | string | root path for text log files, if empty - set __dirname/log |
write_to_file | boolean | |
write_to_console | boolean |
logger.turnOn(pipe, log_this_command)
turn on logger
Kind: instance method of Logger
Param | Type | Description |
---|---|---|
pipe | string | logger pipe |
log_this_command | boolean | write to log event 'TURN_ON', default - false |
logger.turnOff(pipe, log_this_command)
turn off logger
Kind: instance method of Logger
Param | Type | Description |
---|---|---|
pipe | string | logger pipe |
log_this_command | boolean | write to log event 'TURN_OFF', default - false |
logger.debug(message, pipe, trace_objects, additional_param) ⇒ type_write_result
save message as debug
Kind: instance method of Logger
Returns: type_write_result - result write debug
Param | Type | Description |
---|---|---|
message | string | message |
pipe | Array.<string> | string | logger pipe |
trace_objects | any | Array.<any> | trace object list |
additional_param | type_additional_param | Array.<type_additional_param> | additional params, contat to message |
logger.error(error, pipe, trace_objects, additional_param) ⇒ type_write_result
save message as error
Kind: instance method of Logger
Returns: type_write_result - result write error
Param | Type | Description |
---|---|---|
error | any | object error or error text |
pipe | string | Array.<string> | logger pipe |
trace_objects | any | Array.<any> | trace object list |
additional_param | type_additional_param | Array.<type_additional_param> | additional params, contat to message |
console_log(allow, text)
Kind: global function
Param | Type |
---|---|
allow | boolean |
text | string |
console_error(allow, text)
Kind: global function
Param | Type |
---|---|
allow | boolean |
text | string |
type_message
Kind: global typedef
Properties
Name | Type |
---|---|
dd | Date |
type | string |
message | string |
message_core | string |
pipes | Array.<string> |
trace_objects | any | Array.<any> |
additional_params | Array.<type_additional_param> |
write_result | type_write_result |
type_write_result
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
debug_file | string | debug full file name |
error_file | string | error full file name |
trace_file | string | trace full file name |
type_additional_param
part message with format {key: value}
Kind: global typedef
Properties
Name | Type |
---|---|
key | string |
value | string |
type_writefiles
Kind: global typedef
Param | Type | Description |
---|---|---|
files | Array.<type_writefiles> | |
callback | function | error |
Properties
Name | Type | Description |
---|---|---|
file_name | string | |
file_data | string | async write many files with one callback |