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
\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 withprettyPrint: 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
jsonis set tofalse, 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的更多相关文章
- winston日志管理1
Usage There are two different ways to use winston: directly via the default logger, or by instantiat ...
- winston日志管理3
Further Reading 延伸阅读 Events and Callbacks in Winston winston的事件和回调 Each instance of winston.Logger i ...
- winston日志管理2
上次讲到 Exceptions 例外 Handling Uncaught Exceptions with winston 使用winston处理未捕获的异常(这个如果对于异步,我不是很喜欢用) 使用 ...
- Nodejs日志管理包
Nodejs日志管理工具包:log4js 和 winston 1.log4js的使用 1)package.json中加入依赖 "log4js":"~0.6.21" ...
- 第13章 Linux日志管理
1. 日志管理 (1)简介 在CentOS 6.x中日志服务己经由rsyslogd取代了原先的syslogd服务.rsyslogd日志服务更加先进,功能更多.但是不论该服务的使用,还是日志文件的格式其 ...
- ABP(现代ASP.NET样板开发框架)系列之8、ABP日志管理
点这里进入ABP系列文章总目录 基于DDD的现代ASP.NET开发框架--ABP系列之8.ABP日志管理 ABP是“ASP.NET Boilerplate Project (ASP.NET样板项目)” ...
- 【Java EE 学习 76 下】【数据采集系统第八天】【通过AOP实现日志管理】【日志管理功能分析和初步实现】
一.日志管理相关分析 1.日志管理是一种典型的系统级别的应用,非常适合使用spring AOP实现. 2.使用日志管理的目的:对系统修改的动作进行记录,比如对权限.角色.用户的写操作.修改操作.删除操 ...
- ElasticSearch+NLog+Elmah实现Asp.Net分布式日志管理
本文将介绍使用NLOG.Elmah结合ElasticSearch实现分布式日志管理. 一.ElasticSearch简介 ElasticSearch是一个基于Lucene的搜索服务器.它提供了一个分布 ...
- Apache 日志管理,获取客户端端口号
日志管理分类 日志文件是用户管理和监控 Apache 安全的非常好的第一手资料,它清晰地记录了客户端访问 Apache 服务器资源的每一条记录,以及在访问中出现的错误信息,可以这样说,Apache 可 ...
随机推荐
- PHP统计字符串里单词查询关键字
<?function full_count_words($str) { //返回完整数组,包含字符串里每个单词 $words = str_word_count($str,1); ...
- lucene 使用注意
1.建立索引时,忘记writer.close(); 结果: 正常结果:
- Ubuntu彻底删除MySQL重装MySQL
1.删除 mysql sudo apt-get autoremove --purge mysql-server-5.0 sudo apt-get remove mysq ...
- the basic index concept
Computer Science An Overview _J. Glenn Brookshear _11th Edition Over the years numerous variations o ...
- javaee基本环境搭建
安装包 安装jdk :D:\Program Files\Java\jdk1.7.0_17 下载tomcat:E:\apache-tomcat-6.0.36 下载maven:E:\apache-mave ...
- stage划分
整个stage的划分会根据最后触发的action进行倒推,如果碰到宽依赖就将当前范围内的rdd划分为一个stage,直到所有的RDD遍历完为止.
- jboss中文支持
一.中文问题 如果操作系统不支持中文, 应首先使操作系统上的Server支持中文. 修改run.conf中 -Dfile.encoding=gbk -Ddefault.client.encoding= ...
- Js(javaScript)的闭包原理
问题?什么是js(javaScript)的闭包原理,有什么作用? 一.定义 官方解释:闭包是一个拥有许多变量和绑定了这些变量的环境的表达式(通常是一个函数),因而这些变量也是该表达式的一部分. 小编 ...
- window对象;document对象;
window对象: DOM:文档对象模型 --树模型文档:标签文档,对象:文档中每个元素对象,模型:抽象化的东西 一:window: 属性(值或者子对象):opener:打开当前窗口的源窗口,如果当前 ...
- Mongo中的数组操作
当前mongo中有这么一条数据 book是一个数组,在他后面添加一条数据 { "_id" : ObjectId("5721f504d1f70435632b5ce7&quo ...