Пример #1
0
        public void Log(string message, BaseLogType baseLogType, LogLevel logLevel, LogDetails details = null, Exception ex = null, string memberName = "",
                        string sourceFilePath = "", int sourceLineNumber = 0)
        {
            details ??= new LogDetails();

            //add possible exception and info about where the log was written into the logDetails
            details.Add(LogMetadataFieldNames.MemberName, memberName)
            .Add(LogMetadataFieldNames.SourceFilePath, sourceFilePath)
            .Add(LogMetadataFieldNames.SourceLineNumber, sourceLineNumber);

            if (ex != null)
            {
                details.Add(LogMetadataFieldNames.Exception, ex);
            }

            Log(message, baseLogType, details, logLevel);
        }
Пример #2
0
 protected abstract void Log(string message, BaseLogType logType, LogDetails details, LogLevel loglevel);
Пример #3
0
 public void Fatal(string message, BaseLogType logType, LogDetails details = null, Exception ex = null, string memberName = "",
                   string sourceFilePath = "", int sourceLineNumber = 0)
 {
     Log(message, logType, LogLevel.Fatal, details, ex, memberName, sourceFilePath, sourceLineNumber);
 }
Пример #4
0
 public void Error(string message, BaseLogType logType, LogDetails details = null, Exception ex         = null, [CallerMemberName] string memberName = "",
                   [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
 {
     Log(message, logType, LogLevel.Error, details, ex, memberName, sourceFilePath, sourceLineNumber);
 }