private static void ConfigureLoggingChannel(DataAccessLoggingChannel channel, LoggingState logginState) { if (channel.LogDataAccessAgent is LoggingSqlDataAccessAgent) { LoggingSqlDataAccessAgent agent = (LoggingSqlDataAccessAgent)channel.LogDataAccessAgent; agent.CopyDicomDataSetOnDisk = true; agent.DataSetFolder = logginState.DataSetDirectory; } }
public static void ConfigureLogger(Logger logger, LoggingState loggingState, ILoggingDataAccessAgent2 dataAccess) { logger.Enabled = loggingState.EnableLogging; logger.EnableThreading = loggingState.EnableThreading; if (logger.Filter is EventLogFilter) { EventLogFilter filter = ( EventLogFilter )logger.Filter; filter.LogErrors = loggingState.LogErrors; filter.LogInformation = loggingState.LogInformation; filter.LogWarnings = loggingState.LogWarnings; filter.LogDebug = loggingState.LogDebug; filter.LogAudit = loggingState.LogAudit; } DataAccessLoggingChannel[] channels = logger.LoggingChannels.OfType <DataAccessLoggingChannel>().ToArray(); if (channels.Length > 0) { foreach (DataAccessLoggingChannel channel in logger.LoggingChannels.OfType <DataAccessLoggingChannel> ( )) { channel.LogDataAccessAgent = dataAccess; channel.LogDicomDataSet = loggingState.LogDicomDataSet; channel.LogDicomCommunication = loggingState.LogDicom; ConfigureLoggingChannel(channel, loggingState); } } else { DataAccessLoggingChannel channel = new DataAccessLoggingChannel(dataAccess); channel.LogDicomDataSet = loggingState.LogDicomDataSet; channel.LogDicomCommunication = loggingState.LogDicom; ConfigureLoggingChannel(channel, loggingState); logger.LoggingChannels.Clear( ); logger.LoggingChannels.Add(channel); } logger.Logging -= new EventHandler <LogEventArgs> (Logger_Logging); logger.Logged -= new EventHandler <LogEventArgs> (Logger_Logged); logger.Logging += new EventHandler <LogEventArgs> (Logger_Logging); logger.Logged += new EventHandler <LogEventArgs> (Logger_Logged); }