zoukankan      html  css  js  c++  java
  • 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);

  • 相关阅读:
    HBase 操作
    HBase Java API 例子
    微信浏览器拖动出现黑色/白色背景、网址问题解决方案
    layui弹出层置顶弹出
    使用layui时,ajax执行后,重新渲染页面的方法
    宝塔更新
    js 播放音频文件 兼容火狐 谷歌浏览器
    SAP断点
    error_log 用法
    SE开头的事务代码
  • 原文地址:https://www.cnblogs.com/jay--zhang/p/5980671.html
Copyright © 2011-2022 走看看