{"repo":"cocowalla/serilog-sinks-file-archive","free":true,"listed":false,"github":"https://github.com/cocowalla/serilog-sinks-file-archive","clone":"git clone https://github.com/cocowalla/serilog-sinks-file-archive.git","description":"Plugin for the Serilog File sink that works with rolling log files, archiving completed log files before they are deleted by Serilog's retention mechanism","language":"C#","stars":32,"topics":["serilog","logging","compression","gzip","archive"],"license":"Apache-2.0","category":"analytics","readme_excerpt":"Serilog.Sinks.File.Archive A FileLifecycleHooks -based plugin for the Serilog File Sink that works with rolling log files, archiving completed log files before they are deleted by Serilog's retention mechanism. The following archive methods are supported: - Compress logs in the same directory (using GZip compression) - Copying logs to another directory - Compress logs (using GZip compression) and write them to another directory Getting started To get started, install the latest Serilog.Sinks.File.Archive package from NuGet: To enable archiving, use one of the new LoggerSinkConfiguration extensions that has a FileLifecycleHooks argument, and create a new ArchiveHooks . For example, to write GZip compressed logs to another directory (the directory will be created if it doesn't already exist): Or to copy logs as-is to another directory: Or to write GZip compressed logs to the same directory the logs are written to: Note that archival only works with rolling log files, as files are only deleted by Serilog's rolling file retention mechanism. As is standard with Serilog, it's important to call Log.CloseAndFlush(); before your application ends. Token Replacement The targetDirectory constructor parameter supports replacement of tokens at runtime. Tokens take the form {Name:FormatString} , where Name is the name of a supported token, and FormatString defines how the token value should be formatted. At present, 2 tokens are supported, UtcDate and Date . These use standard .NET date for","default_branch":null,"files":null,"tree":[],"storefront":"/r/cocowalla","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/cocowalla/serilog-sinks-file-archive/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}