public static void WriteLineIf(bool condition, string msg) { if (DefaultContext != null) { DefaultContext.AppendLineIf(condition, msg); } else { ChoTrace.Error(msg); } }
public static void WriteSeperatorIf(bool condition) { if (DefaultContext != null) { DefaultContext.AppendLineIf(condition, ChoTrace.SEPERATOR); } else { ChoTrace.Error(ChoTrace.SEPERATOR); } }
public static void WriteNewLineIf(bool condition) { if (DefaultContext != null) { DefaultContext.AppendIf(condition, Environment.NewLine); } else { ChoTrace.Error(Environment.NewLine); } }
public static bool Write(Exception ex) { if (DefaultContext != null) { DefaultContext.Append(ex); } else { ChoTrace.Error(ex.ToString()); } return(true); }
public static bool WriteNThrow(Exception ex) { IChoProfile profile = GetDefaultContext(new StackFrame(1)); if (profile != null) { profile.Append(ex); } else { ChoTrace.Error(ex.ToString()); } throw new ChoApplicationException("Failed to write.", ex); }
public static bool Write(Exception ex) { IChoProfile profile = GetDefaultContext(new StackFrame(1)); if (profile != null) { profile.Append(ex); } else { ChoTrace.Error(ex.ToString()); } return(true); }
private static void Refresh() { try { lock (_padLock) { //_propDict.Clear(); } if (ChoMetaDataFilePathSettings.Me != null) { _pbsDataFilepath = ChoMetaDataFilePathSettings.Me.OverridenPBSDataFilePath; } if (!ChoAppFrxSettings.Me.DisableMetaDataConfig) { ChoXmlDocument.CreateXmlFileIfEmpty(_pbsDataFilepath); _pbsDataChangeWatcher = new ChoAppConfigurationChangeFileWatcher(PBS_DATA_KEY, _pbsDataFilepath, _includeFiles); _pbsDataChangeWatcher.SetConfigurationChangedEventHandler(PBS_DATA_FILE_WATCHER_KEY, (sender, e) => { Refresh(); }); } if (!_pbsDataFilepath.IsNullOrWhiteSpace() && File.Exists(_pbsDataFilepath)) { using (ChoXmlDocument xmlDocument = new ChoXmlDocument(_pbsDataFilepath)) { _rootNode = xmlDocument.XmlDocument.DocumentElement; _includeFiles = xmlDocument != null ? xmlDocument.IncludeFiles : null; } } BuildProfileBackingStores(); } catch (Exception ex) { ChoTrace.Error(ex.ToString()); //throw; } }
private static void BuildProfileBackingStores() { string xpath = @"//configuration/loggers/profileBackingStores/profileBackingStore"; if (_rootNode == null) { return; } lock (_pbsStoreLock) { _pbsStoreDef.Clear(); foreach (XmlNode pbsNode in _rootNode.SelectNodes(xpath)) { if (pbsNode == null) { continue; } try { ChoProfileBackingStoreDef profileBackingStoreDef; profileBackingStoreDef = pbsNode.ToObject(typeof(ChoProfileBackingStoreDef)) as ChoProfileBackingStoreDef; if (!_pbsStoreDef.ContainsKey(profileBackingStoreDef.Name)) { _pbsStoreDef.Add(profileBackingStoreDef.Name, profileBackingStoreDef); } else { throw new ApplicationException("{0}: Duplicate profile backing store found.".FormatString(profileBackingStoreDef.Name)); } } catch (Exception ex) { ChoTrace.Error(ex); } } } }