Esempio n. 1
0
 public SizeLimitedFileSink(ITextFormatter formatter, TemplatedPathRoller roller, long fileSizeLimitBytes,
                            RollingLogFile rollingLogFile, Encoding encoding = null)
 {
     this.formatter          = formatter;
     this.roller             = roller;
     this.fileSizeLimitBytes = fileSizeLimitBytes;
     this.output             = OpenFileForWriting(roller.LogFileDirectory, rollingLogFile, encoding ?? Encoding.UTF8);
 }
 public SizeLimitedFileSink(ITextFormatter formatter, TemplatedPathRoller roller, long fileSizeLimitBytes,
     RollingLogFile rollingLogFile, Encoding encoding = null)
 {
     this.formatter = formatter;
     this.roller = roller;
     this.fileSizeLimitBytes = fileSizeLimitBytes;
     this.EnableLevelLogging = roller.PathIncludesLevel;
     this.output = OpenFileForWriting(roller.LogFileDirectory, rollingLogFile, encoding ?? Encoding.UTF8);
 }
        public SizeRollingFileSink(string pathFormat, ITextFormatter formatter, long fileSizeLimitBytes,
            TimeSpan? retainedFileDurationLimit, Encoding encoding = null)
        {
            roller = new TemplatedPathRoller(pathFormat);

            this.formatter = formatter;
            this.fileSizeLimitBytes = fileSizeLimitBytes;
            this.encoding = encoding;
            this.retainedFileDurationLimit = retainedFileDurationLimit;
            this.currentSink = GetLatestSink();
        }
        public SizeRollingFileSink(string pathFormat, ITextFormatter formatter, long fileSizeLimitBytes,
            TimeSpan? retainedFileDurationLimit, Encoding encoding = null)
        {
            roller = new TemplatedPathRoller(pathFormat);

            this.formatter = formatter;
            this.fileSizeLimitBytes = fileSizeLimitBytes;
            this.encoding = encoding;
            this.retainedFileDurationLimit = retainedFileDurationLimit;
            this.currentSink = GetLatestSink();

            if (AsyncOptions.SupportAsync)
            {
                this.queue = new BlockingCollection<LogEvent>(AsyncOptions.BufferSize);
                Task.Run((Action)ProcessQueue, cancelToken.Token);
            }
        }
 internal RollingLogFile Next(TemplatedPathRoller roller, LogEventLevel? level = null)
 {
     this.Level = level;
     var fileName = roller.GetLogFilePath(DateTime.UtcNow, level, SequenceNumber + 1);
     return new RollingLogFile(fileName, DateTime.UtcNow, SequenceNumber + 1, level.HasValue ? level.ToString() : null);
 }
Esempio n. 6
0
        internal RollingLogFile Next(TemplatedPathRoller roller)
        {
            var fileName = roller.GetLogFilePath(DateTime.UtcNow, SequenceNumber + 1);

            return(new RollingLogFile(fileName, DateTime.UtcNow, SequenceNumber + 1));
        }