Skip to content

Add extension method to chain FileLifecycleHooks together - #141

Merged
nblumhardt merged 15 commits into
serilog:devfrom
EamonHetherton:dev
Apr 20, 2020
Merged

nblumhardt merged 15 commits into
serilog:devfrom
EamonHetherton:dev

Conversation

@EamonHetherton

Copy link
Copy Markdown
Contributor

Allows composing of FileLifecycleHooks e.g. Add FileHeaders and GZip the logs, or compress then encrypt.

@nblumhardt

Copy link
Copy Markdown
Member

Looks good; since FileLifecycleHooks is defined in this assembly, it could be implemented as an instance method rather than an extension?

Since there's a strong concept of ordering between chained hooks, perhaps we could use a name like Then() or something along those lines?

var hooks = new GZipHooks().Then(new HeaderWriter("File Header"));

@EamonHetherton

Copy link
Copy Markdown
Contributor Author

yeah, agree on both. Was never happy with "ChainTo" :)

And it is an extension as it started life in my own project, but makes sense as an instance.

will update...

@nblumhardt
nblumhardt merged commit 7106445 into serilog:dev Apr 20, 2020
@nblumhardt

Copy link
Copy Markdown
Member

LGTM! 👍

@nblumhardt nblumhardt mentioned this pull request Jun 22, 2021
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.

2 participants