144 Commits

Author SHA1 Message Date
Mark Stosberg
d5a13227f9
Avoid data loss with conflictig 'msg' values. (#876)
If msg appears as a string and in the object, preserve it as "originalMsg"

Before, the `msg` copy in the the object was lost.
2020-07-15 17:57:49 +02:00
Ivan Semochkin
0b16636155
Issue 87 child binding redact bug (#856)
* Fix redaction by wildcard path for child logger bindings

* Remove extra spaces
2020-06-02 22:55:08 +02:00
Matteo Collina
362ed662bf
Set sync: true when passing in no defaults (#852)
In the migration to the sync flag, we have changed the default of pino
making it async by default. This resolves the problem.

Fixes #849
2020-05-30 11:54:40 +02:00
Aleksandr
422026a4b7
Allow to suppress prettyPrint flush sync warning (#841)
* Allow to suppress prettyPrint flush sync warning

* Clarify pretty documentation

Co-authored-by: James Sumners <james@sumners.email>

Co-authored-by: James Sumners <james@sumners.email>
2020-05-25 12:24:28 +02:00
Aleksandr
22dce3be32
Remove pino extreme mentions in docs and code (#838)
* Remove pino.extreme mentions in docs

* Replace pino.extreme usages with async pino.destination
2020-05-12 00:42:28 +02:00
Ioannis Poulakas
0bb7a06b6e
Support formatters.log on pretty print (#809)
* Support formatters.log on pretty print

* Make msg available on pretty print with formatters.log applied

* Ensure object exists

* Re-add lastMsg tests
2020-04-06 18:03:22 +02:00
Matteo Collina
97efe4150e
Correctly forwards chindings to prettyPrint when using option (#810)
Fixes https://github.com/pinojs/pino-pretty/issues/104
2020-04-04 13:56:34 +02:00
James Sumners
8872c6ccb9
Implement a log method hook 2020-04-01 19:17:26 -04:00
James Sumners
486f30a0e5
Remove implicit appending of objects to message strings 2020-03-23 18:17:19 -04:00
Tomas Della Vedova
f3ab176c90
Add formatters for core log components (#775)
* WIP: added bindings and levels serializers

* Addressed comments

* Fixed test

* Moved from custom srializers to formatters

* Use stricter check in genLsCache

* Updated test

* Addressed comments

* Added log formatter and removed pino.* serializer

* Updated test

* Use factory for formatters object

* Added deprecations messages
- deprecated useLevelLabels
- deprecated changeLevelName
- deprecated pino.* serializer

* Updated test

* Addressed comments

* Fix test

* Improve code coverage

* Fixed levelKey handling

* Updated test

* Addressed comments

* Updated test

* Added formatters benchmarks

* Rename test

* 100% code coverage

* Added formatters to benchmark runner

* Updated documentation

* Update docs/api.md

Co-Authored-By: James Sumners <james@sumners.email>

* Update docs/api.md

Co-Authored-By: James Sumners <james@sumners.email>

* Update docs/api.md

Co-Authored-By: James Sumners <james@sumners.email>

* Update docs/api.md

Co-Authored-By: James Sumners <james@sumners.email>

* Update docs/api.md

Co-Authored-By: James Sumners <james@sumners.email>

* Update docs/api.md

Co-Authored-By: James Sumners <james@sumners.email>

* Addressed comments

Co-authored-by: James Sumners <james@sumners.email>
Co-authored-by: Matteo Collina <hello@matteocollina.com>
2020-03-18 14:18:02 +01:00
Matteo Collina
5c850004fe
Avoid the term "extreme", there are just sync and async destinations. (#791)
* Update sonic-boom to 1.0.0

* New object-based options for pino.destination()

* fixup

* docs update

* Update docs/api.md

Co-Authored-By: James Sumners <james@sumners.email>

Co-authored-by: James Sumners <james@sumners.email>
2020-03-17 23:26:59 +01:00
James Sumners
cfa05e16a6
Merge branch 'master' into next-master-merge 2020-02-28 19:59:06 -05:00
Alexander Kureniov
092eb8b126
Bind pino instance to prettifier (#721)
* feat(prettifier): bind pino instance to prettier

* style(lint): fix codestyle

* test: add tests

* docs(pretty): add info

* fix(docs): docs fix

* fix: bind prettifier

* fix: pass instance directly
2020-02-28 19:12:10 +01:00
Andrew van Rooyen
72eb875edc
Deprecate the changeLevelName option and alias it to levelKey (#772)
* deprecate the `changeLevelName` option and alias it to `levelKey`

* use process.emitWarning instead of console.warn for deprecation message

* avoid accessing private state in changeLevelName deprecation test
2020-02-28 19:11:47 +01:00
Nikolay Lapshin
8ab8595264
Fixed stream metadata loss during prettification (#780)
* Fixed stream metadata loss during prettification

For streams with Symbol('metadata') true flag, pino metadata was lost during prettification

* Fixed way to adding metadata in stream

* Created setMetadataProps function which adding logger metadata to stream instance if need
2020-02-28 19:04:50 +01:00
James Sumners
0e47e2dc23
Makes #711 mergable (#777)
* Log literal null values (fixes #706)

* When passing multiple parameters, omit null value

Co-authored-by: Nik <NikxDa@users.noreply.github.com>
2020-02-24 18:26:22 -05:00
Thiebaud Thomas
254d485f61 Remove log version (#623) 2020-02-17 10:40:00 +01:00
David Mark Clements
6fae12ac18
Merge pull request #759 from northscaler/object-key
Support new nestedKey config to avoid property name collisions with pino standard properties when logging objects
2020-01-11 17:26:07 +01:00
Tucker Bickler
e39774e0e8 fix(redaction): remove undefined entries for removed number and boolean values (#756) 2020-01-08 08:37:59 +01:00
Matthew Adams
5d35a08d86 objectKey -> nestedKey, no "you" in docs 2020-01-07 11:06:14 -06:00
Matthew Adams
be9464a4a5 support objectKey config 2020-01-06 18:46:42 -06:00
Matteo Collina
c5c996d240
Updated to standard v13 (#683) 2019-07-17 15:09:01 +02:00
Matteo Collina
7d5455b9e0 Removed useless code in the meta wrapper for pretty 2019-04-05 13:05:51 +02:00
Matteo Collina
f0b8547314 create a shallow copy of the object before logging. 2019-04-05 12:51:17 +02:00
Matteo Collina
ecccbdf7ce Moved obj-wrapping logic inside write 2019-04-05 11:00:51 +02:00
Matteo Collina
693d9f240d make sure msg is picked up from the obj correctly. 2019-04-05 10:48:33 +02:00
Matteo Collina
7fb388f5ab Remove the msg property after logging 2019-04-04 15:37:15 +02:00
Matteo Collina
cf070afecb Fixes after landing 2019-03-27 11:53:51 +01:00
Krisztina Hirth
e3866516b1 Fix bug Global serializer not invoked for strings when base: null (#597)
* Fix bug Global serializer not invoked for strings when `base: null`

* Remove unused symbol

* remove sting interpolation

Co-Authored-By: yellowbrickc <yellowbrickc@users.noreply.github.com>

* Instead of cloning the object parameter, the messageKey prop will be set if needed.
2019-03-27 11:45:37 +01:00
Thomas Thiebaud
1ac1576e70 Fix message precedence over mergedObject 2019-03-22 15:50:31 +01:00
n4zukker
b2fa1e3328 Leading wildcard (#587)
* Support redact paths which start with "*."

* Support redact paths which start with "*." add test

* Get back to 100% coverage
2019-01-18 16:46:52 -05:00
Chris Walker
1afe9d260c fix invalid JSON when redact.remove acts on chindings (#570)
* add failing test for redact.remove on child logger

* fix throw when `redact.remove` acts on chindings

The previous commit holds the failing test case.
This commit fixes the issue, passing the test.

The issue was that using `redact.remove` on a key that was
subsequently used in a child binding, was cause logging on
the child logger to produce JSON with `"key":undefined` in it.

While this doesn't crash the logger, the JSON is invalid and therefore
will break many recieving systems, at best causing logs to be missed.

In the test suite, the output is `JSON.parse`d which throws due to the
invalid output.
2018-12-21 14:15:15 +01:00
Matteo Collina
e1c9528590 Remove lambda hack, as it is not needed anymore with sync destination 2018-12-11 11:06:45 +01:00
Matteo Collina
10536b0680 Make pino.destination sync 2018-12-09 16:45:40 +01:00
Nathan Woltman
155d75ed11 Simplify switch statement (#550)
Both the 'undefined' and 'function' cases can be handled in the same way.
2018-11-22 18:14:28 +01:00
Matteo Collina
ab39407437
do not crash on broken pipe, just redirect to /dev/null (#540)
* do not crash on broken pipe, just redirect to /dev/null

* 100% code coverage
2018-11-06 09:07:01 +00:00
Matteo Collina
7010b5fffb
Makes final warn that is not supported instead of throwing (#528)
* Makes final warn that is not supported instead of throwing

* Warn inside pretty, not in final.

* 100% code coverage

* Typo
2018-10-05 17:39:10 +02:00
Matteo Collina
c26b4737c2
The serializer object should not have a prototype (#527) 2018-10-03 14:11:52 +02:00
Nathan Woltman
4b5db2756c Convert -Infinity to null (#520) 2018-09-24 23:57:47 +02:00
Matteo Collina
aa0bd756fa
Convert NaN and Infinity to null. (#519) 2018-09-24 17:33:08 +02:00
Matteo Collina
faacff3510
Do not override opts if the destination is a string (#513)
Fixes #512.
2018-09-03 14:33:29 +02:00
Nathan Woltman
c4fb9e1f27 Pass props from error objects to pino-pretty (#511) 2018-09-03 08:44:55 +02:00
Matteo Collina
8cc416bf99
Correctly assemble the message when errors are present (#501)
Fixes #500
2018-08-24 13:31:43 +02:00
Gyula Szalai
34692e97a0 Change pino.final docs and tests as requested 2018-08-21 16:00:16 +02:00
Gyula Szalai
fb54a088c2 Use const instead of var in tools.js 2018-08-21 14:25:28 +02:00
Gyula Szalai
b2f6500b23 Modify pino.final to handle calls without a handler 2018-08-21 12:53:34 +02:00
Matteo Collina
7509504ff5
Protect from hacks (#493)
* Do not use SonicBoom if stdout has been tampered. Refactoring.

* docs

* moar docs
2018-08-19 18:22:13 +02:00
Matteo Collina
dd1d42ad82
Do not use SonicBoom for stdout on Lambda (#489) 2018-08-17 12:39:55 +02:00
Matteo Collina
930b0a4cf7
Forward to pretty an error object passed as first arg (#486)
Fixes https://github.com/pinojs/pino-pretty/issues/23
Fixes https://github.com/pinojs/pino-pretty/issues/24
2018-08-14 11:41:59 +02:00
Matteo Collina
1f68f372b8
Fix prettyPrint child data (#485)
Fixes https://github.com/pinojs/pino/issues/484
2018-08-13 12:19:27 +02:00