50 Commits

Author SHA1 Message Date
Mamf
24a6e36d94 Enable method chaining for after writeHead.
writeHead now also returns a reference to the response object as specified here: https://nodejs.org/api/http.html#responsewriteheadstatuscode-statusmessage-headers
2023-10-24 21:40:56 +02:00
Lam Wei Li
ffa9e5e2e4
refactor: typeof to check for undefined (because undefined can be a variable name) 2022-10-01 18:38:14 +08:00
Eugene YOBOUE
04cbdfe6ab fix: update connect-logger.js #1284 2022-07-08 21:32:11 +08:00
Eugene YOBOUE
3279647175 chore(feat): Update #1279 docs 2022-07-03 19:47:47 +00:00
Eugene YOBOUE
9f18c6d6b9 feat: adding function(req, res) support to connectLogger options->nolog arg 2022-07-03 13:32:41 +00:00
Zachary Haber
cad9555948
style: run prettier:fix 2022-06-23 01:00:07 +08:00
Lam Wei Li
4c14bde0bb
chore(lint): moved eslint rule, no-underscore-dangle, with exceptions declared, to file-level 2022-03-12 16:00:40 +08:00
Lam Wei Li
53c6837a60
chore(lint): should not disable eslint rule, no-plusplus, in file-level 2022-03-12 15:42:28 +08:00
Lam Wei Li
2603c975c6
fix: connectLogger not logging on close 2022-01-27 23:57:19 +08:00
Wataru Ashihara
a81500b7e6
style: conform @param to official style
ref. https://jsdoc.app/tags-param.html
2020-05-04 09:13:36 +09:00
Gareth Jones
66fe30e9f4 chore: oh shit I changed the eslint rules 2019-08-01 16:57:32 +10:00
leak4mk0
f9ddc61d07 feat(connectLogger): add response to context 2019-04-26 00:02:51 +09:00
Martin Heidegger
a06e2cc83c chore: updated dependencies (including eslint) 2019-02-20 23:07:23 +09:00
Gareth Jones
6741c0bdce chore: improve coverage for connect middleware 2019-02-04 08:30:35 +11:00
Gareth Jones
054207359d chore: improved connect-logger test coverage 2019-01-31 08:48:09 +11:00
blakambr
84437ef51e feat(connectLogger): added status code rulesets + tests 2018-12-19 16:50:33 +11:00
Gareth Jones
8084e80027 fix(tests): tests failing - config listeners not working in sandbox 2018-01-17 08:24:50 +11:00
Gareth Jones
906a77403d chore(lint): added linting to test files 2017-11-14 08:45:22 +11:00
Gareth Jones
4333261721 fix(levels): added level configuration, fixed smtp appender 2017-03-09 08:28:41 +11:00
e-cloud
7d9dc55ff2 style: upgrade eslint and format the code
no logic changed.
2016-12-12 21:04:34 +08:00
e-cloud
50ce5030df Merge remote-tracking branch 'refs/remotes/upstream/master'
Conflicts:
	lib/appenders/gelf.js
	lib/connect-logger.js
2016-07-18 15:50:52 +08:00
e-cloud
9cc3a88bd7 refactor: more small refactor
1. drop semver related code with no need to detect node version
2. drop license declaration in log4js.js for there is one in the project dir
3. other changes
2016-07-16 13:49:24 +08:00
e-cloud
6146334d01 refactor: connect-logger.js 2016-07-15 19:47:16 +08:00
e-cloud
5328e03802 refactor: just format code according to the editor config(tests passed) 2016-07-14 17:36:30 +08:00
Abrar Ahmed
552a7177bc add req.url so that connect works with restify 2016-07-11 16:06:00 -07:00
Abrar Ahmed
bcc3d4630f add req.url so that connect works with restify 2016-07-11 16:01:21 -07:00
Abrar Ahmed
b55eb70d03 add req.url so that connect works with restify 2016-07-11 15:02:07 -07:00
Gareth Jones
97fc892c00 fixing some jshint errors 2016-04-29 09:11:17 +10:00
Hugues Malphettes
6746e2e048 remove the underscore dependency 2016-01-06 11:23:40 +08:00
Gareth Jones
25cf884f97 Merge branch 'MaxXx1313-master' 2015-06-11 07:11:30 +10:00
Francisco Dans
3bf2bade32 x-forwarded-for 2015-06-01 15:30:46 +02:00
MaxXx1313
799af3be5d add protocol and hostname to output format for express 2015-04-29 17:10:05 +03:00
Christo Fogelberg
25c543f8ae lib/connect-logger.js - allow options.tokens 2015-03-10 06:18:02 +00:00
Christo Fogelberg
24268422cf lib/connect-logger.js - format takes tokens array instead of req, res 2015-03-10 06:13:49 +00:00
Christo Fogelberg
ba80dc1588 Trailing whitespace Sublime removed 2015-03-08 19:36:17 +00:00
osher
cd3971cc03 fix bug: headers are changed after log entry emits
In the original version, the following operation looks synchronic, however it is not:

```
res.end = end;
res.end(data,enc);

//emit the log entry 
```

In fact, it starts a series of async operations, in which the request may yet be changed after the request log has already been emitted
(in our case - a change on request headers was observed, probably by some low level hook or hacky wrap of some http.ServerResponse method that's involved on the process - but called asynchronously)
what leads to situation that the request log does not capture valid data.
(observed by us:
 - request headers
 - calculated end time, when concerning big content
)

The fix just used `setTimeout(function() { /*emit the log entry*/ }, 1)`, but I'm afraid it may not hold true for big contents.
Well. maybe the headers part will, but the response time calculation will lie.

The fix relays on: http://nodejs.org/api/http.html#http_event_finish
2014-11-04 17:28:52 +02:00
mishless
66872d136d Update connect-logger.js to work correctly with express
When used with express levels are wrong since send() does not call writeHead, but sets responseCode on response.
2014-07-30 13:06:51 +03:00
Matthias Adler
2118d8f7b3 fix 'remote-addr' property in connect-logger 2013-12-21 19:42:44 +01:00
Gareth Jones
81fa9c3568 removed unnecessary argument to createNoLogCondition 2013-06-05 08:38:39 +10:00
Gareth Jones
7ca517b5ed simplified createNoLogCondition 2013-06-05 08:37:27 +10:00
Gareth Jones
5d6f00eda4 fixed all lint errors except ones which require refactoring of code 2013-06-04 08:17:36 +10:00
Jure Mav
ac6284add1 Added automatic level detection to connect-logger, depends on http status response.
Update of connect logger example code, compatible with express 3.x
2013-05-11 16:17:23 +02:00
Gareth Jones
61078e88ef fixed the nolog tests 2012-05-09 16:40:27 +10:00
Peter 'Pita' Martischka
4cf1d1cfa4 Fixed a BUG that prevents connectlogger from working if loglevel is WARN 2011-12-07 15:28:35 +01:00
muddydixon
5aabebbdb7 change check target from req.url to req.originalUrl 2011-10-29 11:55:46 +09:00
muddydixon
b5bc9c8322 mod if nolog 2011-10-25 14:28:46 +09:00
muddydixon
c7d3ac4fe1 add nolog operation 2011-10-25 14:09:41 +09:00
Gareth Jones
0968c6709f fixed connect-logger 2011-07-19 09:08:15 +10:00
Gareth Jones
e121ca345a removed main function, now using felixge's sandboxed-module, split code into multiple files 2011-07-12 13:02:48 +10:00
Daniel Bell
59f7e0af3c Added connect/express logger. 2011-04-07 10:19:18 +10:00