Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prettyPrint is deprecated #147

Closed
thebrownfox opened this issue Nov 8, 2021 · 5 comments · Fixed by #170
Closed

prettyPrint is deprecated #147

thebrownfox opened this issue Nov 8, 2021 · 5 comments · Fixed by #170

Comments

@thebrownfox
Copy link

Project throws an error after update to 9.0.0.

(node:8450) [PINODEP008] PinoWarning: prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives.
/home/foxie/Dokumenty/Code/Artur/rutras-backend/node_modules/pino/lib/tools.js:221
    prettyFactory.asMetaWrapper = prettifierMetaWrapper
@mcollina
Copy link
Collaborator

mcollina commented Nov 8, 2021

This is not an error but a warning. Follow the instructions at https://github.com/pinojs/pino-pretty to remove it.

@mcollina
Copy link
Collaborator

mcollina commented Nov 8, 2021

Once you figure it out, would you like to send us a PR to update our docs?

@thebrownfox
Copy link
Author

thebrownfox commented Nov 8, 2021

This is not an error but a warning. Follow the instructions at https://github.com/pinojs/pino-pretty to remove it.

Well, actually localhost crashed. 😅

TypeError: Cannot set properties of undefined (setting 'asMetaWrapper')
    at getPrettyStream (node_modules/pino/lib/tools.js:221:33)
    at normalizeArgs (node_modules/pino/lib/tools.js:433:16)
    at pino (node_modules/pino/pino.js:83:28)
    at Object.register (node_modules/hapi-pino/index.js:55:14)
    at internals.Server.register (node_modules/@hapi/hapi/lib/server.js:495:35)
    at start (index.js:121:15)
[nodemon] app crashed - waiting for file changes before starting...

Once you figure it out, would you like to send us a PR to update our docs?

Sure, I just changed prettyPrint option to false. However, I'd like to have the pretty print available. How can I use/configure pino transport/stream globally?

@mcollina mcollina added the bug label Nov 8, 2021
@thebrownfox
Copy link
Author

This seems to work (taken from PR). Needs latest pino-pretty. This issue can be closed after the package is updated upstream and docs changed to reflect this usage.

	await server.register({
		plugin: HapiPino,
		options: {
			// Redact Authorization headers, see https://getpino.io/#/docs/redaction
			redact: ["req.headers.authorization"],
			transport: {
				target: "pino-pretty",
				options: {
					colorize: true,
					minimumLevel: "info",
					levelFirst: true,
					messageFormat: true,
					timestampKey: "time",
					translateTime: true,
					singleLine: false,
					mkdir: true,
					append: true,
				},
			},
		},
	});

@mcollina
Copy link
Collaborator

Would you like to send a Pull Request to address this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants