Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 protected abstract void Log(string message, BaseLogType logType, LogDetails details, LogLevel loglevel);
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }