How to use the colorConsole function from tracer

Find comprehensive JavaScript tracer.colorConsole code examples handpicked from public code repositorys.

3
4
5
6
7
8
9
10
11
12
* @ website http://sinn.boyagirl.com
* @ use 统一try catch处理中间件
* @ 用于捕获内部错误,输出日志信息
*/ 
const tracer = require('tracer');
const logger = tracer.colorConsole({
  level: 'error',
  format: '{{timestamp}} <{{title}}> {{file}}(#{{line}}): {{message}}',
  file: 'error.log',
  path: __dirname
fork icon42
star icon231
watch icon8

158
159
160
161
162
163
164
165
166
167
    maxLogFiles: 10,
    allLogsFileName: 'debug',
    dateformat: 'yyyy-mm-dd HH:MM:ss.L'
  })
} else {
  logger = tracer.colorConsole({ dateformat: 'yyyy-mm-dd HH:MM:ss.L' })
}
tracer.setLevel(appConfig.logLevel)

const options = {
fork icon0
star icon0
watch icon0

24
25
26
27
28
29
30
31
32
33
34
35


// const fs = require('fs')
// const tracer = require('tracer')
// const rTracer = require('cls-rtracer')


// const logger = tracer.colorConsole({
//     format: [
//         '{{timestamp}} <{{title}}> ({{file}}:{{line}}) {{message}}', // default format
//         {
//             error: '{{timestamp}} <{{title}}> ({{file}}:{{line}}) {{message}}\nCall Stack:\n{{stack}}', // error format
fork icon0
star icon0
watch icon0