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

Add support for logging levels #211

Closed
peschkaj opened this issue Dec 10, 2021 · 1 comment
Closed

Add support for logging levels #211

peschkaj opened this issue Dec 10, 2021 · 1 comment

Comments

@peschkaj
Copy link

It would be helpful to add log levels to exceptions so they can be filtered.

I propose adding (these match with the names in use in Microsoft.Extensions.Logging.LogLevel:

  • Trace
  • Debug
  • Info
  • Warning
  • Error
  • Critical

Optionally, we can add None to get things to match perfectly.

The general shape of the solution:

  • Extend the Error class to support logging levels.
  • Modify the backing stores to support logging levels.
  • Create an extension of Exception to provide helpers for setting the log level (e.g., myAwfulException.Warning())
  • Log exceptions with Critical by default.
@NickCraver
Copy link
Owner

In this case, I think the solution should have a different shape - from even the name down to schema is based around exceptions, and not general logging which only has a string (or other structure). The general usage I'd prescribe here would be too only log exceptions to Exceptional, and general purpose logging to another path/location (e.g. if we had an ILogger implementation as in #135, it'd only work for exceptions).

To support this, we'd have to change the serialization and schema for all users, support both current and future schemas in the lib (consider rolling upgrades) at a minimum, all while eating a lot of overhead to log a string, in most cases. IMO, there are many solutions out there for this (Serilog, etc.) so Exceptional mutating into a general logger wouldn't cover new ground and I'd definitely advise going that route.

In looking at logging across a lot of platforms now, it's very expensive, much more than it needs to be. I'd be remiss if we added to this path by bending something never intended for it - if we're doing high scale logging, it should be through an efficient path as Exceptional tries to take with exceptions (and only that) today. Happy to hang on this if it helps.

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

No branches or pull requests

2 participants