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

log only certain levels #46

Open
Paul-Todd opened this issue Jan 11, 2020 · 3 comments
Open

log only certain levels #46

Paul-Todd opened this issue Jan 11, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@Paul-Todd
Copy link

Hi,

Great library! Especially now supporting multiple loggers.

However I have a feature suggesting in that I would like to be able to only log certain levels of errors.
Ideally this level would be per logger but I guess the least impact would be in the main Lumberdash client.

Usecase:
Log error and fatal's to Crashlytics and the rest to the console.
Thanks

Paul

@jorgecoca
Copy link
Contributor

@Paul-Todd I believe you could do that with the existing API, since lumberdash supports an exceptFor field:

String logFatal(

Something like this (pseudo-code):

final shouldFilter = error.runtimeType == NonFatalError;
final exceptForClients = shouldFilter ? [PrintLumberdash] : [];
logError(error, exceptForClients);

If you have an idea for a different API, please share it with us and we can take a look ;)

@IchordeDionysos
Copy link

Yes, this is possible that way, but not very convenient don't you think?

Suppose you put logMessage all over in your project and then you add another logger for only logError then one would have to change every single logMessage to also include the new logger.

Having this option for some logs is cool, but the more common use-case and far more useful use-case would be to restrict it at the logger level.

You might say now:
Well, you can write your own logger. Yes, this works.

But it's not possible to customize an existing logger.

For example: We only want to log errors to sentry, so doing something like this:

SentryLumberdash.withDsn(
  dsn: "...", 
  logLevels: [LogLevel.warning, LogLevel.error]
);

The example above would give the developer the most freedom.

@fwagner fwagner added the enhancement New feature or request label Mar 9, 2021
@fwagner
Copy link
Contributor

fwagner commented Mar 9, 2021

We definitly see value in introducing the concept of log levels to lumberdash and being able to configure the routing of messages to appenders in a central location. It's on our roadmap and we may be able to add this later this year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

4 participants