Comments (5)
I'm probably missing something, but why is the file descriptor needed in extreme mode? From what I understood it is needed to flush data before exit, does it mean that the data of the last push will be stored on a file?
You can use extreme mode only using a native (from core) stream, meaning a TCP/unix socket, a file, or stdout/sderr. Otherwise we cannot guarantee that a) if you process exit naturally, the log content will be on stdout/stderr b) you are not losing any log lines in case of a JS crash.
Anyway if I'm logging to a writable stream what should I initialize to this.fd? open a dummy file and get the descriptor? On the console seems to work also passing a random number (is there a way in node to safely get an unused fd other than the dummy file approach?). Is it the correct way to go or do I have to care about that file (or socket?) to retrieve the last push data in case of failures?
If you are logging to a writable stream, consider logging to a file, and then running a separate process to fetch and process that data. That is "the pino way", which will deliver high throughput.
We are still discussing those handlers, so feel free to join the discussion on #92.
Do you think we can improve the documentation? Would you like to send a PR?
from pino.
Thanks for the info, will try to reword on the doc to see if it gets clearer.
Anyway can I use the dummy file approach to test the difference in performance? Or there will be no
improvement if the data is processed in the same process?
moving the log handling on a separate process may be a risky refactor, but if the difference is notable I'd definitely would like to try it out as I will need to handle soon at least 10 times the current requests..
from pino.
The end result is about 10-20% faster in HTTP applications. It might be less, it really depends on your application, and what are the bottlenecks.
I would recommend you to benchmark both cases and check.
from pino.
Anyway can I use the dummy file approach to test the difference in performance? Or there will be no
improvement if the data is processed in the same process?
Yes you can. The two things are not depending on each other (yet, maybe it will change in the future, who knows).
from pino.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from pino.
Related Issues (20)
- Question: CPU usage overhead vs console.log HOT 10
- pino/file logs do not get populated to docker container via mounted volume until the app closes HOT 2
- Logs written out of order HOT 6
- browser: implement `log` function for the `formatters` option HOT 1
- Simple log file rotation HOT 2
- Request: mixed sync/async transports HOT 5
- transport for file does not work in middleware. HOT 2
- Re-add support for standard console-style parameter logging HOT 6
- transport options - either confusing variable names or I'm just still learning (free to admit it) HOT 1
- create a function to capture full log object HOT 1
- consider using toad-cache HOT 2
- Filtering of the content using transformations in the pipeline for multiple transports HOT 1
- [question] How do I create dynamic customized logfile names? HOT 3
- Inclusive language suggestion: rename default branch to "main" across Pino's repos HOT 3
- Bundling to `ESM` using `vite` HOT 1
- ESLint: Unsafe call of an `any` typed value.(@typescript-eslint/no-unsafe-call) HOT 2
- Applying regex to redact keys or value HOT 3
- Accessing log level label from transport HOT 6
- Verifying logs from unit tests (again!) HOT 6
- `pino.transport.pipeline` may have lost logs HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pino.