 | FileLifecycleHooksOnFileOpened Method |
Initializes or wraps the stream opened for a log file.
This can be used to write file headers, or wrap the stream in another stream
that adds buffering, compression, encryption, etc.
Namespace:
NLog.Targets
Assembly:
NLog (in NLog.dll) Version: 6.0.0+cfb73701cda54e2410b006f649f072e90daef707
Syntaxpublic virtual Stream OnFileOpened(
string filePath,
Stream underlyingStream
)
Public Overridable Function OnFileOpened (
filePath As String,
underlyingStream As Stream
) As Stream
Dim instance As FileLifecycleHooks
Dim filePath As String
Dim underlyingStream As Stream
Dim returnValue As Stream
returnValue = instance.OnFileOpened(filePath,
underlyingStream)
abstract OnFileOpened :
filePath : string *
underlyingStream : Stream -> Stream
override OnFileOpened :
filePath : string *
underlyingStream : Stream -> Stream Parameters
- filePath
- Type: SystemString
The full path to the log file. - underlyingStream
- Type: System.IOStream
The underlying Stream opened on the log file.
Return Value
Type:
StreamThe
Stream NLog should use when writing events to the log file.
Remarks
The underlying file may or may not be empty when this method is called.
NLog takes ownership of the returned stream and disposes it when the file
is closed. If the returned stream wraps underlyingStream,
the returned stream is responsible for disposing the underlying stream.
See Also