133 Commits

Author SHA1 Message Date
sun0day
e6d355cd77
fix(tools): log[level] compatible with when first argument is undefined (fix #1555) (#1565) 2022-09-27 12:25:17 +02:00
Diabl0269
553c66ba3e
Added onChild callback with tests and documentation (#1541)
* Added `onChild` callback with tests and documentation

* Update `onChild` type to also be in options and added types tests

* Apply suggestions from code review

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

* updated documentation

* Updated documentation. 

Expanded `onChild` documentation to mention the function doesn't handle errors

Co-authored-by: James Sumners <james@sumners.email>
2022-09-05 10:12:38 +02:00
Matteo Collina
6d0a310e4e
Remove all mentions of final (#1544)
Signed-off-by: Matteo Collina <hello@matteocollina.com>

Signed-off-by: Matteo Collina <hello@matteocollina.com>
2022-09-01 12:26:00 +02:00
Matteo Collina
4d72bcdb1b
Default fd=1 in pino.destination if stdout has no file descriptor (#1517)
Signed-off-by: Matteo Collina <hello@matteocollina.com>

Signed-off-by: Matteo Collina <hello@matteocollina.com>
2022-08-12 15:52:59 +02:00
Matteo Collina
29911abade
Do not assume process.stdout has a file descriptor (#1503)
* Do not assume process.stdout has a file descriptor

Signed-off-by: Matteo Collina <hello@matteocollina.com>

* fixup

Signed-off-by: Matteo Collina <hello@matteocollina.com>
2022-07-24 21:36:29 +02:00
Matteo Collina
55e25f85f7
Use process.stdout if specified by the developer (#1499)
* Use process.stdout if specified by the developer

Signed-off-by: Matteo Collina <hello@matteocollina.com>

* fixup: add test

Signed-off-by: Matteo Collina <hello@matteocollina.com>
2022-07-21 16:21:15 +02:00
Matteo Collina
171e102d9b
Async by default (#1448)
* Remove prettyPrint option.

100% code coverage back.

* Remove pino.final

* Fix jsdom TS issue

* Restore lost error

* Add link to pino-pretty

* Update Node.js in workflows

* Async loggic by default

Signed-off-by: Matteo Collina <hello@matteocollina.com>

* Update docs/asynchronous.md

Co-authored-by: Igor Savin <iselwin@gmail.com>

* Update docs/asynchronous.md

Co-authored-by: Igor Savin <iselwin@gmail.com>

* Update docs/asynchronous.md

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

* fix flaky test

Signed-off-by: Matteo Collina <hello@matteocollina.com>

Co-authored-by: Igor Savin <iselwin@gmail.com>
Co-authored-by: James Sumners <james@sumners.email>
2022-06-01 08:27:43 +02:00
Matteo Collina
ff1546b8bb
Remove deprecated API and options in v7 option. (#1249)
* Remove prettyPrint option.

100% code coverage back.

* Remove pino.final

* Fix jsdom TS issue

* Restore lost error

* Add link to pino-pretty

* Update Node.js in workflows

Co-authored-by: Igor Savin <iselwin@gmail.com>
2022-06-01 00:25:55 +02:00
Christian Savard
03bb312e96
Add option to pass custom levels down to multistream() from transport (#1398)
* add option to pass down custom levels to multistream

* fix types

* update docs

* add test for types

* combine custom with default levels when useOnlyCustomLevels is not set

* add tranport test
2022-04-08 23:35:33 +02:00
Josh Kelley
572ac0a2c0
Fix hasOwnProperty usage (#1359) 2022-03-23 22:58:06 +01:00
Guilherme Kammsetzer
39204eaffb
fix: Throw when using custom level formatters with multiple transports (#1353) (#1362) 2022-03-09 10:36:11 +01:00
ZYSzys
bc3dd5de84
chore: simplify formatters normalize (#1294) 2022-01-08 12:27:01 +01:00
KaKa
6d4144aad0
fix: passing stream to transport (#1286)
* fix: passing stream to transport

* fix: opts.transport checking
2021-12-30 12:35:15 +01:00
James Sumners
4b0009e9f2
Coerce string integer destinations to file descriptors (#1180) 2021-11-22 09:08:43 +01:00
Sameer Srivastava
6c538159dc
Deprecation warning for pino.final() in Node v14+ (#1199) 2021-11-02 17:09:11 +01:00
Sameer Srivastava
43906c71e7
Fixes issue with nested keys (#1198)
* fix: fixes issue with nested keys

* chore: use strictSame in nested key test
2021-10-29 15:10:35 +02:00
Sameer Srivastava
f16c98d7d7
Fix max-depth using safe-stable-stringify (#1169)
* fix: max-depth specified for stringifying

* chore: Added options to set custom limits

* chore: removed console.log

* chore: per-base-logger safe stringify

* types removed
docs updated

* unused json-stringify-safe removed

* test for non circular objects

* chore: updated docs

* chore: doc update for arrays
2021-10-26 14:26:14 +02:00
Etienne de Dieuleveult
1ea480e6f2
fix formatters when used along transport (#1162) 2021-10-15 17:23:12 +02:00
Matteo Collina
59ac907d09 Add caller option to transport 2021-10-13 15:35:52 +02:00
Matteo Collina
e9eb267d38
Correctly select the correct file when using the transport option (#1147) 2021-10-07 14:48:27 +02:00
javiertury
a802d5e591
fix: make pino.final sync flushes when no handler provided (#1126) (#1127)
* fix: make pino.final sync flushes when no handler provided (#1126)

* refactor(final): remove unused error in catch

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

Co-authored-by: James Sumners <james@sumners.email>
2021-09-13 15:19:40 +02:00
Manuel Spigolon
bd67ef93bf
add transports constructor option (#1111)
* add transports constructor option

* rename option

* docs: add transport option

* fix tests

* Apply suggestions from code review

Co-authored-by: Matteo Collina <matteo.collina@gmail.com>

* docs: add more examples

* Apply suggestions from code review

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

* Apply suggestions from code review

Co-authored-by: David Mark Clements <david.mark.clements@gmail.com>

* Apply suggestions from code review

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

* fix test

Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
Co-authored-by: James Sumners <james@sumners.email>
Co-authored-by: David Mark Clements <david.mark.clements@gmail.com>
2021-09-08 18:26:11 +02:00
Matteo Collina
f78dd5ca75
Deprecate the prettyPrint option (#1122) 2021-09-08 13:13:02 +02:00
Matteo Collina
f712a52e05
pino-pretty transport convertion (#1110)
* partial transport convertion

* some code coverage

* fixed type tests

* use pino/file instead of #pino/file

* tiny fixes

* Fixed docs
2021-09-06 15:46:43 +02:00
Matteo Collina
67ceb5f509
Automatically flush the logs on exit in Node v14+ (#1091) 2021-08-20 15:50:52 +02:00
Matteo Collina
60193825cf
Completely removed extreme mode (#1090) 2021-08-19 14:57:09 +02:00
Matteo Collina
16f1f0a66d
Replace fast-safe-stringify with json-stringify-safe (#1066)
Fixes https://github.com/pinojs/pino/issues/1062
2021-07-12 14:22:23 +02:00
Matteo Collina
849f65aab4
pino.transport() (#1003) 2021-07-03 15:48:18 +02:00
Matteo Collina
3c0613a291 Merge branch 'master' into next 2021-05-22 15:43:31 +02:00
mihai1voicescu
75a54cf427
Make the nestedKey only take effect in the serialized object and fix … (#885)
* Make the nestedKey only take effect in the serialized object and fix error detection and serialization (closes #883)

proto.js
* Copy the message property in case the obj is an error and there is a msg specified
* Load the msg as a property of obj if metadata is needed

symbols.js
* Add nestedKeyStrSym to quickly cache the string

tools.js
* Manually build the stringify for performance reasons (not too pretty...)

error.test.js + serializers.test.js
* Add a test for the new nestedKey interaction

* Add tests to complete the coverage

* Address PR notes

* Fix test title

* Fix tests

Co-authored-by: Mihai Voicescu <mihaivo@intern.pch>
2021-05-19 10:00:13 +02:00
Matus Sabo
379e57cbc8
fix: prettyPrint options - misleading error message with wrong option value (#1012)
* fix: prettyPrint options - misleading error message with wrong options value

* fix: rewrite throws in tests - remove unnecessary code and make code more readable
2021-04-16 17:30:11 +02:00
Matteo Collina
cba70129a8 Merge branch 'master' into next 2021-04-06 18:45:21 +02:00
salesh
dfe518b4b6 Fix linter 2021-01-15 20:01:26 +01:00
salesh
98e31c0057 Fix for...in 2021-01-15 19:16:34 +01:00
salesh
2fd82b761f Replacing var with let/const, somewhere left var because scope, somewhere left var because for + resolved all standard issues 2021-01-13 23:52:56 +01:00
Dong Yun
24c493baa0
access log level in hook #909 (#944)
* feat: add level param for hook #909

* chore: add unit test
2020-12-31 11:37:29 +01:00
Matteo Collina
546616fcaa Apply err serializer everywhere. (#896)
* Apply err serializer everywhere.

* Handle cases where the err serializer is not set

* Added docs

* Typo
2020-12-13 15:07:35 +01:00
Jafer Khan
596c98f99e Eliminate quotes from ISO time 2020-09-10 03:33:29 +05:00
James Sumners
f8bf228056 Revert "Avoid data loss with conflictig 'msg' values. (#876)"
This reverts commit d5a13227f91a66ba04fbd713c4a08b46e8a1f991.
2020-07-31 18:16:07 -04:00
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