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);

  • 相关阅读:
    使用select和shutdown
    SMTP协议初探(二)linux下c编程实现发邮件
    ortp使用详解 ortprelease.pdf
    网易校园招聘c++题目如何让new操作符不分配内存,只调用构造函数
    虚拟地址空间,堆栈,堆,数据段,代码段
    关于double的输入输出
    CodeForces1238DABstring CodeForces思维+字符串反向思考
    CodeForces1234CPipesdfs
    CodeForces1221A2048 Game思维题
    排序
  • 原文地址:https://www.cnblogs.com/jay--zhang/p/5980671.html
Copyright © 2011-2022 走看看