Exemplo n.º 1
0
 public ResourceLog(bool enabled, string logSource, string logDirectory, TimeSpan maxAge, TimeSpan streamFlushInterval, TimeSpan backgroundWriteInterval, long maxDirectorySize = 0L, long maxLogFileSize = 0L, int bufferSize = 0)
 {
     this.enabled = enabled;
     if (enabled)
     {
         ArgumentValidator.ThrowIfNullOrEmpty("logDirectory", logDirectory);
         ArgumentValidator.ThrowIfNullOrEmpty("logSource", logSource);
         ArgumentValidator.ThrowIfInvalidValue <TimeSpan>("maxAge", maxAge, (TimeSpan age) => age > TimeSpan.Zero);
         ArgumentValidator.ThrowIfInvalidValue <TimeSpan>("streamFlushInterval", streamFlushInterval, (TimeSpan interval) => interval > TimeSpan.Zero);
         ArgumentValidator.ThrowIfInvalidValue <TimeSpan>("backgroundWriteInterval", backgroundWriteInterval, (TimeSpan interval) => interval > TimeSpan.Zero);
         ArgumentValidator.ThrowIfInvalidValue <long>("maxDirectorySize", maxDirectorySize, (long number) => number >= 0L);
         ArgumentValidator.ThrowIfInvalidValue <long>("maxLogFileSize", maxLogFileSize, (long number) => number >= 0L);
         ArgumentValidator.ThrowIfNegative("bufferSize", bufferSize);
         this.logSource       = logSource;
         this.schema          = new LogSchema("Microsoft Exchange Server", Assembly.GetExecutingAssembly().GetName().Version.ToString(), "Transport Resource Log", ResourceLog.Fields);
         this.asyncLogWrapper = AsyncLogWrapperFactory.CreateAsyncLogWrapper("ResourceLog_" + Process.GetCurrentProcess().ProcessName, new LogHeaderFormatter(this.schema), "ResourceLog");
         this.asyncLogWrapper.Configure(logDirectory, maxAge, maxDirectorySize, maxLogFileSize, bufferSize, streamFlushInterval, backgroundWriteInterval);
     }
 }
Exemplo n.º 2
0
 internal static IAsyncLogWrapper CreateAsyncLogWrapper(string logFileName, LogHeaderFormatter logHeaderFormatter, string logComponentName)
 {
     return(AsyncLogWrapperFactory.CreateAsyncLogWrapperFunc(logFileName, logHeaderFormatter, logComponentName));
 }