public void Info(string user, string message, LogAppender logAppender, bool canNotify = false) { bool canAppendWithSQL = logAppender == LogAppender.all || logAppender == LogAppender.sql; bool canAppendWithFILE = logAppender == LogAppender.all || logAppender == LogAppender.file; Action <ILogBase> log = x => x.Info(user, message); try { if (canAppendWithSQL) { log.Invoke(LogDB.GetLog(DbConnection)); } if (canAppendWithFILE) { if (string.IsNullOrEmpty(LoggingPathFile)) { throw new Exception("file path is empty."); } LogFile.GetLog(LoggingPathFile).Info(user, message); } } catch (Exception ex) { throw ex; } }
public void Error <T>(T valueObject, string user, string message, Exception exception, LogAppender logAppender, bool canNotify = false) where T : class { bool canAppendWithSQL = logAppender == LogAppender.all || logAppender == LogAppender.sql; bool canAppendWithFILE = logAppender == LogAppender.all || logAppender == LogAppender.file; Action <ILogBase> log = x => x.Error(valueObject, user, message, exception); try { if (canAppendWithSQL) { log.Invoke(LogDB.GetLog(DbConnection)); } if (canAppendWithFILE) { if (string.IsNullOrEmpty(LoggingPathFile)) { throw new Exception("file path is empty."); } log.Invoke(LogFile.GetLog(LoggingPathFile)); } } catch (Exception) { throw; } }