Exemple #1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="FileLogger" /> class.
 /// </summary>
 /// <param name="fileLoggerParams">The file logger parameters.</param>
 public FileLogger(FileLoggerParams fileLoggerParams)
 {
     Name = fileLoggerParams.InstanceName;
     MustBeDisposed = fileLoggerParams.MustBeDisposed;
     UseFormattedText = fileLoggerParams.UseFormattedText;
     Directory.CreateDirectory(fileLoggerParams.Directory);
     StreamWriter =
         new StreamWriter(Path.Combine(fileLoggerParams.Directory, fileLoggerParams.FileName,
             $"{fileLoggerParams.FileName}-{DateTime.Now:yyyy-MM-dd_hh-mm-ss}.txt"))
         {AutoFlush = true};
     IsEnabled = true;
 }
Exemple #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="FileLogger" /> class.
 /// </summary>
 /// <param name="fileLoggerParams">The file logger parameters.</param>
 public FileLogger(FileLoggerParams fileLoggerParams)
 {
     Name             = fileLoggerParams.InstanceName;
     MustBeDisposed   = fileLoggerParams.MustBeDisposed;
     UseFormattedText = fileLoggerParams.UseFormattedText;
     Directory.CreateDirectory(fileLoggerParams.Directory);
     StreamWriter =
         new StreamWriter(Path.Combine(fileLoggerParams.Directory, fileLoggerParams.FileName,
                                       $"{fileLoggerParams.FileName}-{DateTime.Now:yyyy-MM-dd_hh-mm-ss}.txt"))
     {
         AutoFlush = true
     };
     IsEnabled = true;
 }