Exemplo n.º 1
0
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing && this.rollingHelper != null)
         {
             this.rollingHelper.Close();
         }
     }
     finally
     {
         this.rollingHelper = null;
         base.Dispose(disposing);
     }
 }
Exemplo n.º 2
0
        public RollingLogStreamWriter(string baseFileName, long maxFileSize, int maxFiles, int bufferSize, IFormatProvider formatProvider) : base(formatProvider)
        {
            string directoryName = Path.GetDirectoryName(baseFileName);

            if (!Directory.Exists(directoryName))
            {
                Directory.CreateDirectory(directoryName);
            }
            this.baseFileName  = baseFileName;
            this.maxFiles      = maxFiles;
            this.maxFileSize   = maxFileSize;
            this.bufferSize    = bufferSize;
            this.rollingHelper = new RollingLogStreamWriter.StreamWriterRollingHelper(this);
            this.encoding      = this.rollingHelper.Writer.Encoding;
        }