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 a LoggingSink abstract type? #74

Open
oxinabox opened this issue Feb 2, 2023 · 0 comments
Open

Add a LoggingSink abstract type? #74

oxinabox opened this issue Feb 2, 2023 · 0 comments

Comments

@oxinabox
Copy link
Member

oxinabox commented Feb 2, 2023

Logging Sinks should always have:

shouldlog(::LoggingSink, arg...) = true
min_enabled_level(::LoggingSink = BelowMinLevel
catch_exceptions(filelogger::FileLogger) = true  # probably

(for the last see #38)

With a user defined:

handle_message(::MySink, args...; kwargs...) = ...

That is what makes them Sinks

So we could make it an abstract type all user sinks inherit from.

An alternative is we could make a generic sink that takes a function as it's argument, and then calls that function for handle_message, but that is uglier if they need to keep state, and disallows overriding catch_exceptions

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

1 participant