Skip to content

Conversation

srogovtsev
Copy link
Contributor

@srogovtsev srogovtsev commented Apr 8, 2023

Closes #1447: we can simply proxy a parameter to SecondaryLoggerSink to make this work.

The one thing I'm not so sure here is related to the public API change. I've decided to add a new overload method so that the older WriteTo.Logger(logger, restrictedToMinimumLevel) wouldn't break, but maybe I'm missing something less evident (or more preferable) here.

@srogovtsev srogovtsev changed the title Closes #1447: ability to dispose nested loggers Adding ability to dispose nested loggers in WriteTo.Logger Apr 8, 2023
@srogovtsev
Copy link
Contributor Author

srogovtsev commented Apr 8, 2023

I think I might have solved the public API in the second commit. Now we should have only WriteTo.Logger(ILogger logger, bool attemptDispose = false, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum) visible on a regular basis, but WriteTo.Logger(logger, restrictedToMinimumLevel ) calls will not be affected.

Copy link
Member

@augustoproiete augustoproiete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nblumhardt
Copy link
Member

Sorry about the slow turnaround @srogovtsev, I'll be able to loop back to this soon!

public LoggerConfiguration Logger(
ILogger logger,
bool attemptDispose = false,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sink configuration functions with restrictedToMinimumLevel should now also usually have LevelSwitch support; since this is a new signature, we can tack the extra parameter on without breakage before 3.0, so I'll follow up with a PR for that :-)

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

Successfully merging this pull request may close these issues.

An ability to dispose nested loggers
3 participants