@@ -20,18 +20,18 @@ public class FileLogHandler : ILogHandler, IDisposable
20
20
/// <summary>
21
21
/// Initializes a new instance of the <see cref="FileLogHandler"/> class with the specified file path.
22
22
/// </summary>
23
- /// <param name="path ">The path of the log file.</param>
24
- public FileLogHandler ( string path )
23
+ /// <param name="filePath ">The path of the log file.</param>
24
+ public FileLogHandler ( string filePath )
25
25
{
26
- if ( string . IsNullOrEmpty ( path ) ) throw new ArgumentException ( "File log path cannot be null or empty." , nameof ( path ) ) ;
26
+ if ( string . IsNullOrEmpty ( filePath ) ) throw new ArgumentException ( "File log path cannot be null or empty." , nameof ( filePath ) ) ;
27
27
28
- var directory = Path . GetDirectoryName ( path ) ;
28
+ var directory = Path . GetDirectoryName ( filePath ) ;
29
29
if ( ! string . IsNullOrWhiteSpace ( directory ) && ! Directory . Exists ( directory ) )
30
30
{
31
31
Directory . CreateDirectory ( directory ) ;
32
32
}
33
33
34
- _fileStream = File . Open ( path , FileMode . OpenOrCreate , FileAccess . Write , FileShare . Read ) ;
34
+ _fileStream = File . Open ( filePath , FileMode . OpenOrCreate , FileAccess . Write , FileShare . Read ) ;
35
35
_fileStream . Seek ( 0 , SeekOrigin . End ) ;
36
36
_streamWriter = new StreamWriter ( _fileStream , System . Text . Encoding . UTF8 )
37
37
{
@@ -47,7 +47,7 @@ public void Handle(LogEvent logEvent)
47
47
{
48
48
lock ( _lockObj )
49
49
{
50
- _streamWriter . WriteLine ( $ "{ logEvent . Timestamp : r } { _levels [ ( int ) logEvent . Level ] } { logEvent . IssuedBy . Name } : { logEvent . Message } ") ;
50
+ _streamWriter . WriteLine ( $ "{ logEvent . Timestamp : yyyy-MM-dd HH:mm:ss.fff } { _levels [ ( int ) logEvent . Level ] } { logEvent . IssuedBy . Name } : { logEvent . Message } ") ;
51
51
}
52
52
}
53
53
0 commit comments