/// <summary> /// Constructor /// </summary> /// <param name="config"> /// A config instance whose value members must be copied into this /// instance (deep copy) /// </param> protected LogConfig(LogConfig config) { // Create deep copy m_autoStart = config.m_autoStart; m_autoFlushPeriodicTime = config.m_autoFlushPeriodicTime; m_autoFlushStartupTime = config.m_autoFlushStartupTime; m_cleanupLogs = config.m_cleanupLogs; m_cleanupMessages = config.m_cleanupMessages; m_cleanupResources = config.m_cleanupResources; m_cleanupSessions = config.m_cleanupSessions; m_folder = config.m_folder; m_folderPath = config.m_folderPath; m_globalLevels = config.m_globalLevels; m_globalTrace = config.m_globalTrace; m_formattersObject = config.m_formattersObject.Clone(); m_formattersException = config.m_formattersException.Clone(); m_defaultEntry = config.m_defaultEntry.Clone(); // Create deep copy of entries collection m_listEntries = new List <LogConfigEntry>(); foreach (var entry in config.m_listEntries) { m_listEntries.Add((LogConfigEntry)entry.Clone()); } // Create deep copy of monitors collection m_listMonitors = new List <LogConfigMonitorType>(); foreach (var monitor in config.m_listMonitors) { m_listMonitors.Add((LogConfigMonitorType)monitor.Clone()); } }
/// <summary> /// Constructor /// </summary> /// <param name="provider"> /// A LogConfigFormatterProvider instance whose value members must be copied into /// this instance (deep copy) /// </param> protected LogConfigFormatterProvider(LogConfigFormatterProvider <T> provider) { // Copy members m_syncRoot = new object(); m_defaultFormatterType = provider.m_defaultFormatterType.Clone(); m_formatterTypes = new List <LogConfigFormatterType <T> >(); // Clone formatters for (int i = 0; i < provider.FormatterTypes.Count; i++) { m_formatterTypes.Add(provider.FormatterTypes[i].Clone()); } }
// ****************************************************************** // * * // * Constructors * // * * // ****************************************************************** /// <summary> /// Constructor /// </summary> public LogConfig() { // Set members to default m_autoStart = DEFAULT_AUTOSTART; m_autoFlushPeriodicTime = DEFAULT_AUTOFLUSHPERIODICTIME; m_autoFlushStartupTime = DEFAULT_AUTOFLUSHSTARTUPTIME; m_cleanupLogs = DEFAULT_CLEANUPLOGS; m_cleanupMessages = DEFAULT_CLEANUPMESSAGES; m_cleanupResources = DEFAULT_CLEANUPRESOURCES; m_cleanupSessions = DEFAULT_CLEANUPSESSIONS; m_folder = DEFAULT_FOLDER; m_folderPath = DEFAULT_FOLDERPATH; m_globalLevels = DEFAULT_GLOBALLEVELS; m_globalTrace = DEFAULT_GLOBALTRACE; m_listEntries = new List <LogConfigEntry>(); m_listMonitors = new List <LogConfigMonitorType>(); m_formattersObject = new LogConfigFormatterProvider <object>(); m_formattersException = new LogConfigFormatterProvider <Exception>(); m_defaultEntry = CreateDefaultEntry(); }