Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make FileSink constructor changes non-breaking; fix a bug whereby a s…
…pecified encoding is not used; clean and tidy
- Loading branch information
1 parent
1864db1
commit b660b51
Showing
7 changed files
with
60 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
// Copyright 2019 Serilog Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System.IO; | ||
|
||
namespace Serilog | ||
{ | ||
using System.IO; | ||
|
||
/// <summary> | ||
/// Enables hooking into log file lifecycle events | ||
/// Enables hooking into log file lifecycle events. | ||
/// </summary> | ||
public abstract class FileLifecycleHooks | ||
{ | ||
/// <summary> | ||
/// Wraps <paramref name="underlyingStream"/> in another stream, such as a GZipStream, then returns the wrapped stream | ||
/// Initialize or wrap the <paramref name="underlyingStream"/> opened on the log file. This can be used to write | ||
/// file headers, or wrap the stream in another that adds buffering, compression, encryption, etc. The underlying | ||
/// file may or may not be empty when this method is called. | ||
/// </summary> | ||
/// <remarks> | ||
/// Serilog is responsible for disposing of the wrapped stream | ||
/// A value must be returned from overrides of this method. Serilog will flush and/or dispose the returned value, but will not | ||
/// dispose the stream initially passed in unless it is itself returned. | ||
/// </remarks> | ||
/// <param name="underlyingStream">The underlying log file stream</param> | ||
/// <returns>The wrapped stream</returns> | ||
public abstract Stream Wrap(Stream underlyingStream); | ||
/// <param name="underlyingStream">The underlying <see cref="Stream"/> opened on the log file.</param> | ||
/// <returns>The <see cref="Stream"/> Serilog should use when writing events to the log file.</returns> | ||
public virtual Stream OnOpened(Stream underlyingStream) => underlyingStream; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters