@manbalboy(정훈) : manbalboy@hanmail.net
- Winston
- Winston-daily-rotate-file
- chalk
0.0.1 : initialize
- Enter nuxt-logger-winston in the npm command line command
npm install nuxt-logger-winston
- Add nuxt-logger-winston to the modules section of nuxt.config.js
- Configure it :
{
modules: [
// Simple usage
'nuxt-logger-winston',
// With options
['nuxt-logger-winston', { /* module options */ }]
]
}
Logging levels in nuxt-logger-winston conform to the severity ordering specified by RFC5424: severity of all levels is assumed to be numerically ascending from most important to least important.
Each level is given a specific integer priority. The higher the priority the more important the message is considered to be, and the lower the corresponding integer priority. For example, as specified exactly in RFC5424 the syslog levels are prioritized from 0 to 7 (highest to lowest).
The currently set log level is as follows
const LOG_LEVELS = {
error: 0,
alert: 1,
access: 2,
warn: 3,
info: 4,
debug: 5,
};
This log level cannot be changed in the current version and we intend to provide it in the near future.
The color values mapped to the log level are:
const LOG_COLORS = {
error: 'red',
alert: 'black yellowBG',
access: 'magenta',
warn: 'yellow',
info: 'green',
debug: 'blue',
};
Default : true
Determines whether the log is active or inactive
Default : 'logs' Set the LOG directory name based on the root path
Default : 'YYYY-MM-DD HH:mm:ss:ms' Format to be represented in timestamp entries
Default : true
Whether the logger format is expressed in JSON format
Default :
CONSOLE_LOG_CONFIG: {
IS_ACTIVE: true,
LOG_LEVEL: 'debug',
IS_JSON: false
},
LOG setting object to be displayed in CMD window
Default : true
Set whether to display the log in the CMD window
Default : 'debug'
Log level to be displayed on CMD
Default : false
JSON format or not
Default :
FILE_LOG_CONFIG: [
{ FILE_NAME: 'error', LOG_LEVEL: 'error', DATE_PATTERN: 'YYYY-MM-DD', IS_JSON: true },
{ FILE_NAME: 'all', LOG_LEVEL: 'debug', DATE_PATTERN: 'YYYY-MM-DD', IS_JSON: true },
]
The file log setting is defined as an array.
Create a file log object and include it in the file log configuration array.
FILE_NAME is a required value and cannot be duplicated.
Default : 'error'
Log level that should be written to the file
Default : 'YYYY-MM-DD-HH'
A string representing the moment.js date format to be used for rotating. The meta characters used in this string will dictate the frequency of the file rotation. For example, if your DATE_PATTERN is simply 'HH' you will end up with 24 log files that are picked up and appended to every day. (default: 'YYYY-MM-DD-HH')
Default : true
JSON format or not
Creates a banner string at startup. The default is the current author's default banner is active.
/examples folder reference Main file
- nuxt.config.js
- /examples/pages/index.uve