Introduction
LTSV format logger for (connect|express).
This is just a wrapper of connect.middleware.logger.
Usage
var express = ltsvlogger = ; // define output WriteStreamvar out = fs // define tokensvar ltsv = ;ltsv;ltsv;ltsv;ltsv;ltsv;ltsv;ltsv;ltsv;ltsv; var app = ;app;
tail -f ltsv-access.loghost:127.0.0.1<TAB>ident:-<TAB>user:-<TAB>time:[13/Feb/2013:19:15:44 +09:00]<TAB>req:GET /stylesheets/style.css HTTP/1.1<TAB>status:200<TAB>size:110<TAB>referer:http://localhost:3001/<TAB>ua:Mozilla/5.0 AppleWebKit/537.17 Chrome/24.0.1312.57 Safari/537.17
Options
- format: Format string or Token array, see below for tokens
- stream :is the same as connect.logger.
- buffer: is the same as connect.logger.
- immediate: is the same as connect.logger.
Formats
Just override connect.logger's formats as ltsv
- default
host:127.0.0.1<TAB>ident:-<TAB>user:-<TAB>time:[Wed, 13 Feb 2013 10:00:55 GMT]<TAB>req:GET / HTTP/1.1<TAB>status:200<TAB>size:110<TAB>referer:-<TAB>ua:-
- short
host:127.0.0.1<TAB>ident:-<TAB>req:GET / HTTP/1.1<TAB>status:200<TAB>size:-<TAB>response-time:1 ms
- tiny
req:GET /<TAB>status:200<TAB>size:-<TAB>response-time:1 ms
- dev
concise output colored by response status for development use (Not ltsv format).
Tokens
The following tokens are available
-
time
logger; -
host
logger; -
X-Forwarded-For
logger; -
user
logger; -
ident
logger; -
req
logger; -
method
logger; -
uri
logger; -
protocol
logger; -
status
logger; -
size
logger; -
reqsize
logger; -
referer
logger; -
ua
logger; -
vhost
logger; -
reqtime
logger; -
X-Cache
logger; -
X-Runtime
logger;
Install
npm do
npm install connect-ltsv-logger
License
Source code can be found on github, licenced under MIT.
Author
Developed by Takeharu.Oshida