public virtual void SetInternal(ASafeLog oLog, bool bOverwriteExisting = false) { lock (ms_oLock) { if (m_oLog == null) { m_oLog = oLog; } else if (bOverwriteExisting) { m_oLog = oLog; } } // if } // SetInternal
public FileLog( string sAppName = null, bool bAppend = false, bool bUtcDateInName = false, bool bUtcTimeInName = false, string sPath = null, ASafeLog oLog = null ) : base(oLog) { AppName = (sAppName ?? string.Empty).Trim(); if (this.appName == string.Empty) { this.appName = Assembly.GetCallingAssembly().GetName().Name; } sPath = (sPath ?? string.Empty).Trim(); var oFileName = new StringBuilder(this.appName); if (bUtcTimeInName) { oFileName.Append(DateTime.UtcNow.ToString(".yyyy-MM-dd.HH-mm-ss", CultureInfo.InvariantCulture)); } else if (bUtcDateInName) { oFileName.Append(DateTime.UtcNow.ToString(".yyyy-MM-dd", CultureInfo.InvariantCulture)); } oFileName.Append(".log"); string sFileName = (sPath != string.Empty) ? Path.Combine(sPath, oFileName.ToString()) : oFileName.ToString(); try { m_oLogFile = new StreamWriter(sFileName, bAppend, Encoding.UTF8); } catch (Exception e) { throw new LogException("Failed to open a log file " + sFileName, e); } // try m_oLock = new object(); Init(); } // constructor
public SafeILog(object oCaller, ASafeLog oLog = null) : base(oLog) { if (ReferenceEquals(oCaller, null)) { return; } if (oCaller.GetType() == typeof(Type)) { m_oiLog = LogManager.GetLogger(oCaller as Type); return; } // if if (oCaller is ILog) { m_oiLog = oCaller as ILog; return; } // if m_oiLog = LogManager.GetLogger(oCaller.GetType()); } // constructor
} // static constructor public LegacyLog(ASafeLog oLog = null) : base(oLog) { } // constructor
} // Dispose protected ASafeLog(ASafeLog oLog = null) { m_oLog = oLog; } // constructor
public ConsoleLog(ASafeLog oLog = null) : base(oLog) { } // constructor