question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Only allow logging when wanted

See original GitHub issue

I just started using this library (is awesome BTW), but I have a question, is there anyway to restrict the library from logging at all the events explained at the README.md ?

I wish to set the log at certain moments and not take into consideration those events specified by the documentation. Also this brings up to mind, if I should really use this extension or use pino instead. Also I wish to set different log files for each type logging level and also maintain a general log. (I’m new to logging but must do a hell of a good job)

What do you guys recommend ? (I’m using a hapi server … just to make sure its clear)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mcollinacommented, May 25, 2017

@juanjoLenero 👍 , would you like to send a PR?

1reaction
einnjocommented, May 23, 2017

I could look into this if it’s still needed/wanted.

Maybe a plugin-level option: logEvents.

{
    register: 'hapi-pino',
    options: {
       logEvents: ['server-start', 'server-stop', 'response', 'request-error'] // Default
    }
}

Omitting any of the events would disable that specific log callback in hapi-pino.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python logging only log from script - Stack Overflow
So a better approach is to create a different logger only for your modules and give it some handlers of its own instead...
Read more >
logging — Logging facility for Python — Python 3.11.1 ...
A common scenario is to attach handlers only to the root logger, and to let propagation take care of the rest. setLevel(level)¶. Sets...
Read more >
Logging in Python - Real Python
The logging module provides you with a default logger that allows you to get started without needing to do much configuration. The corresponding...
Read more >
Implement Log out Functionality and Only Allow ... - Egghead.io
You want to add a visual cue as well as a log out button to the nav. To accomplish this, you can check...
Read more >
Application logging for security purposes - Bas Rijnbout
You should include just enough data in your security logs to allow you to detect suspicious actions. But logging too much details can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found