Comparing version 1.8.14 to 1.8.15
# bunyan Changelog | ||
See [the bunyan@2.x changelog](https://github.com/trentm/node-bunyan/blob/master/CHANGES.md) | ||
for details on recent 2.x releases. | ||
Known issues: | ||
@@ -12,2 +15,12 @@ | ||
## 1.8.15 | ||
- [pull #575, #278] Change the default "req" serializer to accept expressjs's | ||
`req.originalUrl` for the "url" field per | ||
<https://expressjs.com/en/api.html#req.originalUrl>. (By @twelve17 and | ||
@kingcody.) | ||
- Development change: Switch to node-tap for testing (from nodeunit, which is | ||
now obsolete). Currently just tap v9 because that is the last major version | ||
of node-tap that supports back to node v0.10. | ||
## 1.8.14 | ||
@@ -14,0 +27,0 @@ |
/** | ||
* Copyright 2020 Trent Mick. | ||
* Copyright 2021 Trent Mick. | ||
* Copyright 2020 Joyent Inc. | ||
@@ -11,3 +11,3 @@ * | ||
var VERSION = '1.8.14'; | ||
var VERSION = '1.8.15'; | ||
@@ -1096,3 +1096,5 @@ /* | ||
method: req.method, | ||
url: req.url, | ||
// Accept `req.originalUrl` for expressjs usage. | ||
// https://expressjs.com/en/api.html#req.originalUrl | ||
url: req.originalUrl || req.url, | ||
headers: req.headers, | ||
@@ -1099,0 +1101,0 @@ remoteAddress: req.connection.remoteAddress, |
{ | ||
"name": "bunyan", | ||
"version": "1.8.14", | ||
"version": "1.8.15", | ||
"description": "a JSON logging library for node.js services", | ||
@@ -39,13 +39,12 @@ "author": "Trent Mick <trentm@gmail.com> (http://trentm.com)", | ||
"devDependencies": { | ||
"nodeunit": "0.9", | ||
"ben": "0.0.0", | ||
"markdown-toc": "0.12.x", | ||
"verror": "1.3.3", | ||
"vasync": "1.4.3" | ||
"tap": "^9.0.3", | ||
"vasync": "1.4.3", | ||
"verror": "1.3.3" | ||
}, | ||
"scripts": { | ||
"check": "make check", | ||
"test": "nodeunit test/*.test.js # skip dtrace tests" | ||
}, | ||
"dependencies": {} | ||
"test": "tap test/*.test.js # skip dtrace tests" | ||
} | ||
} |
@@ -395,3 +395,3 @@ [![npm version](https://img.shields.io/npm/v/bunyan.svg?style=flat)](https://www.npmjs.com/package/bunyan) | ||
bunyan will (a) write an ugly message on stderr (along with the traceback), | ||
and (b) the field in the log record will be replace with a short error message. | ||
and (b) the field in the log record will be replaced with a short error message. | ||
For example: | ||
@@ -418,3 +418,3 @@ | ||
- A serializer function *should be defensive*. In my experience it is common to | ||
- A serializer function *should be defensive*. In my experience, it is common to | ||
set a serializer in an app, say for field name "foo", and then accidentally | ||
@@ -425,3 +425,3 @@ have a log line that passes a "foo" that is undefined, or null, or of some | ||
```javascript | ||
function fooSerializers(foo) { | ||
function fooSerializer(foo) { | ||
// Guard against foo be null/undefined. Check that expected fields | ||
@@ -443,3 +443,3 @@ // are defined. | ||
Bunyan includes a small set of "standard serializers", exported as | ||
`bunyan.stdSerializers`. Their use is completely optional. Example using | ||
`bunyan.stdSerializers`. Their use is completely optional. An example using | ||
all of them: | ||
@@ -467,3 +467,3 @@ | ||
| ----- | ----------- | | ||
| err | Used for serializing JavaScript error objects, including traversing an error's cause chain for error objects with a `.cause()` -- e.g. as from [verror](https://github.com/davepacheco/node-verror). | | ||
| err | Used for serializing JavaScript error objects, including traversing an error's cause chain for error objects with a `.cause()` -- e.g. as from [verror](https://github.com/joyent/node-verror). | | ||
| req | Common fields from a node.js HTTP request object. | | ||
@@ -632,3 +632,3 @@ | res | Common fields from a node.js HTTP response object. | | ||
You can specify your hostname at Logger creation or it will be retrieved | ||
vi `os.hostname()`. | ||
via `os.hostname()`. | ||
- `pid`: Required. Integer. Filled in automatically at Logger creation. | ||
@@ -710,3 +710,3 @@ - `time`: Required. String. Added by Bunyan. Can be overridden. | ||
- Some mechanism to calculate response latency. "restify" users will have | ||
a "X-Response-Time" header. A `latency` custom field would be fine. | ||
an "X-Response-Time" header. A `latency` custom field would be fine. | ||
- `req.body`: If you know that request bodies are small (common in APIs, | ||
@@ -739,3 +739,3 @@ for example), then logging the request body is good. | ||
For convenience, if there is only one stream, it can specified with the | ||
For convenience, if there is only one stream, it can be specified with the | ||
"stream" and "level" options (internally converted to a `Logger.streams`). | ||
@@ -1046,3 +1046,3 @@ | ||
like `logrotate` on Linux or `logadm` on SmartOS/Illumos. In those cases, unless | ||
your are ensuring "copy and truncate" semantics (via `copytruncate` with | ||
you are ensuring "copy and truncate" semantics (via `copytruncate` with | ||
logrotate or `-c` with logadm) then the fd for your 'file' stream will change. | ||
@@ -1361,24 +1361,15 @@ You can tell bunyan to reopen the file stream with code like this in your | ||
## Webpack | ||
Webpack can work with the same example Browserify above. To do this, we need to make webpack ignore optional files: | ||
Create "empty_shim.js": | ||
```javascript | ||
// This is an empty shim for things that should be not be included in webpack | ||
## webpack | ||
To include bunyan in your webpack bundle you need to tell webpack to | ||
ignore the optional dependencies that are unavailable in browser environments. | ||
Mark the following dependencies as | ||
[externals](https://webpack.js.org/configuration/externals/) in your webpack | ||
configuration file to exclude them from the bundle: | ||
``` | ||
Now tell webpack to use this file for | ||
[optional dependencies](https://webpack.github.io/docs/configuration.html#resolve-alias) | ||
in your "webpack.config.js": | ||
``` | ||
resolve: { | ||
// These shims are needed for bunyan | ||
alias: { | ||
'dtrace-provider': '/path/to/shim/empty_shim.js', | ||
fs: '/path/to/shim/empty_shim.js', | ||
'safe-json-stringify': '/path/to/shim/empty_shim.js', | ||
mv: '/path/to/shim/empty_shim.js', | ||
'source-map-support': '/path/to/shim/empty_shim.js' | ||
} | ||
module: { | ||
externals: ['dtrace-provider', 'fs', 'mv', 'os', 'source-map-support'] | ||
} | ||
``` | ||
Now webpack builds, ignoring these optional dependencies via shimming in an empty JS file! | ||
@@ -1385,0 +1376,0 @@ # Versioning |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
201267
1469
1381