配置File Transport

  1. 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 \n).
  • 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);

winston 日志管理4的更多相关文章

  1. winston日志管理1

    Usage There are two different ways to use winston: directly via the default logger, or by instantiat ...

  2. winston日志管理3

    Further Reading 延伸阅读 Events and Callbacks in Winston winston的事件和回调 Each instance of winston.Logger i ...

  3. winston日志管理2

    上次讲到 Exceptions  例外 Handling Uncaught Exceptions with winston 使用winston处理未捕获的异常(这个如果对于异步,我不是很喜欢用) 使用 ...

  4. Nodejs日志管理包

    Nodejs日志管理工具包:log4js 和 winston 1.log4js的使用 1)package.json中加入依赖 "log4js":"~0.6.21" ...

  5. 第13章 Linux日志管理

    1. 日志管理 (1)简介 在CentOS 6.x中日志服务己经由rsyslogd取代了原先的syslogd服务.rsyslogd日志服务更加先进,功能更多.但是不论该服务的使用,还是日志文件的格式其 ...

  6. ABP(现代ASP.NET样板开发框架)系列之8、ABP日志管理

    点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之8.ABP日志管理 ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)” ...

  7. 【Java EE 学习 76 下】【数据采集系统第八天】【通过AOP实现日志管理】【日志管理功能分析和初步实现】

    一.日志管理相关分析 1.日志管理是一种典型的系统级别的应用,非常适合使用spring AOP实现. 2.使用日志管理的目的:对系统修改的动作进行记录,比如对权限.角色.用户的写操作.修改操作.删除操 ...

  8. ElasticSearch+NLog+Elmah实现Asp.Net分布式日志管理

    本文将介绍使用NLOG.Elmah结合ElasticSearch实现分布式日志管理. 一.ElasticSearch简介 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布 ...

  9. Apache 日志管理,获取客户端端口号

    日志管理分类 日志文件是用户管理和监控 Apache 安全的非常好的第一手资料,它清晰地记录了客户端访问 Apache 服务器资源的每一条记录,以及在访问中出现的错误信息,可以这样说,Apache 可 ...

随机推荐

  1. include动作标记和include指令标记学习笔记

    我的jsp学习参考书是耿祥义,张跃平编著的jsp大学使用教程这本书,我也向大家推荐这本书,我觉得这本书适合我的学习方式,知识的讲解透彻易懂. include指令标记                   ...

  2. 微博开发平台java SDK demo学习之examples(demo)

    本文介绍demo中函数的功能分块 账号 评论 收藏 关系/好友分组 地理信息 OAuth2(开发指南) 位置服务(开发指南)

  3. Nginx 笔记与总结(11)Nginx + php-fpm + MySQL 安装 ecshop

    下载 ecshop (ECShop_V2.7.3_UTF8_release1106)安装包,解压之后把 upload 文件夹使用 ftp 传到服务器的 /usr/local/html 目录下,同时改名 ...

  4. Ubuntu 安装 ImageMagic(6.9.1-6)及 PHP 的 imagick (3.0.1)扩展

    关于 ImageMagic 和 imagick 的介绍,见<图片处理神器ImageMagick以及PHP的imagick扩展> 和 <Ubuntu下安装ImageMagick和Mag ...

  5. PDO 学习与使用 ( 一 ) :PDO 对象、exec 方法、query 方法与防 SQL 注入

    1.安装 PDO 数据库抽象层 PDO - PHP Data Object 扩展类库为 PHP 访问数据库定义了一个轻量级的.一致性的接口,它提供了一个数据访问抽象层,针对不同的数据库服务器使用特定的 ...

  6. PHP 随机显示

    <?php  print_r(    array_rand(      array(        "新春快乐"=>"",        " ...

  7. VSS 访问问题

    局域网同一网段的2台电脑,防火墙都是关闭的 A能ping通B 但A在运行输入B的IP地址 不能访问 求解答 1.确认输入的地址格式没有写错,例如B的IP地址为:192.168.1.20.那么在A电脑的 ...

  8. 学习之道-从求和起-求和曲线面积瞬时速率极限微积分---求和由高解低已知到未知高阶到低阶连续自然数的K次方之和

    数学分析 张筑生

  9. hiho47 : 拓扑排序·一

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 由于今天上课的老师讲的特别无聊,小Hi和小Ho偷偷地聊了起来. 小Ho:小Hi,你这学期有选什么课么? 小Hi:挺多的,比 ...

  10. FTS抓包看AVDTP

    1.概述   测试过程为打开Audio连接,没有听音乐,人后断开Audio连接,主要目的是为了测试AVDTP的工作流程.   2.Frame分析    首先贴出抓取的关于AVDTP的包: 在L2CAP ...