• winston 日志管理4


    配置File Transport

    winston.add(winston.transports.File, options)

    The File transport should really be the 'Stream' transport since it will accept any WritableStream. It is named such because it will also accept filenames via the 'filename' option:

    • level: Level of messages that this transport should log.
    • silent: Boolean flag indicating whether to suppress output.
    • colorize: Boolean flag indicating if we should colorize output.
    • timestamp: Boolean flag indicating if we should prepend output with timestamps (default true). If function is specified, its return value will be used instead of timestamps.
    • filename: The filename of the logfile to write output to.
    • maxsize: Max size in bytes of the logfile, if the size is exceeded then a new file is created, a counter will become a suffix of the log file.
    • maxFiles: Limit the number of files created when the size of the logfile is exceeded.
    • stream: The WriteableStream to write output to.
    • json: If true, messages will be logged as JSON (default true).
    • eol: string indicating the end-of-line characters to use (default to  ).
    • prettyPrint: If true, additional JSON metadata objects that are added to logging string messages will be displayed as a JSON string representation. If function is specified, its return value will be the string representing the meta.
    • depth Numeric indicating how many times to recurse while formatting the object with util.inspect (only used with prettyPrint: true) (default null, unlimited)
    • logstash: If true, messages will be logged as JSON and formatted for logstash (default false).
    • showLevel: Boolean flag indicating if we should prepend output with level (default true).
    • formatter: If function is specified and json is set to false, its return value will be used instead of default output. (default undefined)
    • tailable: If true, log files will be rolled based on maxsize and maxfiles, but in ascending order. The filenamewill always have the most recent log lines. The larger the appended number, the older the log file. This option requires maxFiles to be set, or it will be ignored.
    • maxRetries: The number of stream creation retry attempts before entering a failed state. In a failed state the transport stays active but performs a NOOP on it's log function. (default 2)
    • zippedArchive: If true, all log files but the current one will be zipped.
    • options: options passed to fs.createWriteStream (default {flags: 'a'}).

    Metadata: Logged via util.inspect(meta);

  • 相关阅读:
    TIF转JPG
    跨线程取出控件的值的写法(不是跨线程赋予控件值)
    oracle根据正则表达式查找对应的字段
    oracle数据库连接字符串
    access检测表没有的字段,添加之
    解决 Unable to load DLL 'OraOps9.dll': 找不到指定的模块。 (Exception from HRESULT: 0x8007007E)
    oracle关键字使用
    to_number,Extract oracle的关键字
    OracleCommand.CommandText 无效
    调用带参数的线程两种方法
  • 原文地址:https://www.cnblogs.com/jay--zhang/p/5980671.html
Copyright © 2020-2023  润新知