pinojs / pino-pretty

🌲Basic prettifier for Pino log lines
MIT License
1.27k stars 150 forks source link

Doesn't work in browser #332

Closed avetisk closed 2 years ago

avetisk commented 2 years ago

Getting the follow error when using in the browser (with Next.js):

error - ./node_modules/pino-pretty/lib/utils.js:7:23
Module not found: Can't resolve 'worker_threads'

While pino({ prettyPrint: { ... }) is deprecated, it still works properly in the browser.

jsumners commented 2 years ago

At no point has pino-pretty ever been intended to be used in a browser environment.

avetisk commented 2 years ago

Then you should mention it in the docs.

Because when you read this in the pino docs:

Pino is compatible with browserify for browser side usage: This can be useful with isomorphic/universal JavaScript code.

You legitimately think that pino-pretty may also be browser friendly.

jsumners commented 2 years ago

pino-pretty !== pino

DoisKoh commented 2 years ago

It would be nice for it to be compatible in the browser though. Certain frameworks (specifically thinking of Svelte) requires the code to be isomorphic - Pino's great because it's supported on the browser and allows us to use it everywhere. Pretty-printing it on the browser during development would be great.

jsumners commented 2 years ago

pino-pretty has never been intended to be used in a production situation. Also, it is specifically designed for reading input from stdin and streaming the manipulated data.

adrianwix commented 2 years ago

I think @DoisKoh is not asking to use pino-pretty in production but in development. No one wants to read unformatted error logs in development. Also @avetisk has a fair point, he is talking about user expectations. Not about about pino === pino-pretty

hirako2000 commented 5 months ago

I do suggest to mention it on the README. or rename this project pino-nodepretty Would save many people a little bit of time :)