vv-mssql-logger
v0.9.24
Published
```cmd npm i vv-mssql-logger ``` ```js const lib_mssql_logger = require('vv-mssql-logger')
Downloads
5
Readme
Install & Use
npm i vv-mssql-logger
const lib_mssql_logger = require('vv-mssql-logger')
let logger = lib_mssql_logger.create({
timezone_minutes: 180,
schema: 'vv',
table: 'log',
time_save_seconds: 10,
time_life_seconds: 345600
})
//EXEC THIS QUERY BY YOUR MS SQL DRIVER:
//logger.query_create_tables()
lib_mssql_logger.on_save(logger, params => {
//EXEC THIS QUERY BY YOUR MS SQL DRIVER:
//params.query
})
lib_mssql_logger.on_delete(logger, params => {
//EXEC THIS QUERY BY YOUR MS SQL DRIVER:
//params.query
})
lib_mssql_logger.on_add(logger, log => {
console.log(log)
})
logger.trace_for_all_log_add('app name', 'my best app')
logger.pipe_on() //turn on empty pipe
logger.log('hello 1 (no ignored, because empty pipe)')
logger.log('hello 2 (no ignored too)', {traces: {key: 't1', data: 'd1'}} )
logger.log('hello 3 (ignored, because "my pipe" turned off)', {pipes: 'my pipe'})
logger.pipe_on('my pipe') //turn on "my pipe" pipe
logger.log('hello 3 (no ignored)', {pipes: 'my pipe'})
App
Kind: global class
new App([options])
| Param | Type | | --- | --- | | [options] | type.constructor_options |
app._env : type.env
Kind: instance property of App
app.pipe_on([pipe])
add pipe for which you need to enable logging
Kind: instance method of App
| Param | Type | | --- | --- | | [pipe] | string |
app.pipe_off([pipe])
add pipe for which you need to disable logging
Kind: instance method of App
| Param | Type | | --- | --- | | [pipe] | string |
app.trace_for_all_error_add(key, data)
adding information to be added to all error
Kind: instance method of App
| Param | Type | | --- | --- | | key | string | | data | string |
app.trace_for_all_log_add(key, data)
adding information to be added to all log
Kind: instance method of App
| Param | Type | | --- | --- | | key | string | | data | string |
app.trace_for_all_error_remove(key)
see trace_for_all_error_add
Kind: instance method of App
| Param | Type | | --- | --- | | key | string |
app.trace_for_all_log_remove(key)
see trace_for_all_log_add
Kind: instance method of App
| Param | Type | | --- | --- | | key | string |
app.error(message, [options])
write error
Kind: instance method of App
| Param | Type | | --- | --- | | message | string | Error | | [options] | type.message_options |
app.log(message, [options])
write log
Kind: instance method of App
| Param | Type | | --- | --- | | message | string | | [options] | type.message_options |
app.save()
force save buffer to database
Kind: instance method of App