Bleeding next
This commit is contained in:
@@ -22,16 +22,7 @@ namespace Swan {
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public LogMessageReceivedEventArgs(
|
||||
UInt64 sequence,
|
||||
LogLevel messageType,
|
||||
DateTime utcDate,
|
||||
String source,
|
||||
String message,
|
||||
Object? extendedData,
|
||||
String callerMemberName,
|
||||
String callerFilePath,
|
||||
Int32 callerLineNumber) {
|
||||
public LogMessageReceivedEventArgs(UInt64 sequence, LogLevel messageType, DateTime utcDate, String source, String message, Object? extendedData, String callerMemberName, String callerFilePath, Int32 callerLineNumber) {
|
||||
this.Sequence = sequence;
|
||||
this.MessageType = messageType;
|
||||
this.UtcDate = utcDate;
|
||||
|
||||
+2
-365
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -28,306 +27,7 @@ namespace Swan.Logging {
|
||||
}
|
||||
}
|
||||
|
||||
/*#region Standard Public API
|
||||
|
||||
/// <summary>
|
||||
/// Registers the logger.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of logger to register.</typeparam>
|
||||
/// <exception cref="InvalidOperationException">There is already a logger with that class registered.</exception>
|
||||
public static void RegisterLogger<T>() where T : ILogger {
|
||||
lock(SyncLock) {
|
||||
ILogger loggerInstance = Loggers.FirstOrDefault(x => x.GetType() == typeof(T));
|
||||
|
||||
if(loggerInstance != null) {
|
||||
throw new InvalidOperationException("There is already a logger with that class registered.");
|
||||
}
|
||||
|
||||
Loggers.Add(Activator.CreateInstance<T>());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the logger.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public static void RegisterLogger(ILogger logger) {
|
||||
lock(SyncLock) {
|
||||
Loggers.Add(logger);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters the logger.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException">logger.</exception>
|
||||
public static void UnregisterLogger(ILogger logger) => RemoveLogger(x => x == logger);
|
||||
|
||||
/// <summary>
|
||||
/// Unregisters the logger.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of logger to unregister.</typeparam>
|
||||
public static void UnregisterLogger<T>() => RemoveLogger(x => x.GetType() == typeof(T));
|
||||
|
||||
/// <summary>
|
||||
/// Remove all the loggers.
|
||||
/// </summary>
|
||||
public static void NoLogging() {
|
||||
lock(SyncLock) {
|
||||
Loggers.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
#region Debug
|
||||
|
||||
/// <summary>
|
||||
/// Logs a debug message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Debug(this String message, String source = null, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Debug, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a debug message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public static void Debug(this String message, Type source, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Debug, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a debug message to the console.
|
||||
/// </summary>
|
||||
/// <param name="extendedData">The exception.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Debug(this Exception extendedData, String source, String message, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Debug, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Trace
|
||||
|
||||
/// <summary>
|
||||
/// Logs a trace message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The text.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Trace(this String message, String source = null, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Trace, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a trace message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public static void Trace(this String message, Type source, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Trace, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a trace message to the console.
|
||||
/// </summary>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Trace(this Exception extendedData, String source, String message, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Trace, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Warn
|
||||
|
||||
/// <summary>
|
||||
/// Logs a warning message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The text.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Warn(this String message, String source = null, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Warning, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a warning message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public static void Warn(this String message, Type source, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Warning, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a warning message to the console.
|
||||
/// </summary>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Warn(this Exception extendedData, String source, String message, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Warning, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Fatal
|
||||
|
||||
/// <summary>
|
||||
/// Logs a warning message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The text.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Fatal(this String message, String source = null, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Fatal, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a warning message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public static void Fatal(this String message, Type source, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Fatal, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a warning message to the console.
|
||||
/// </summary>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Fatal(this Exception extendedData, String source, String message, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Fatal, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Info
|
||||
|
||||
/// <summary>
|
||||
/// Logs an info message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The text.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Info(this String message, String source = null, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Info, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs an info message to the console.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public static void Info(this String message, Type source, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Info, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs an info message to the console.
|
||||
/// </summary>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Info(this Exception extendedData, String source, String message, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Info, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Error
|
||||
|
||||
/// <summary>
|
||||
/// Logs an error message to the console's standard error.
|
||||
/// </summary>
|
||||
/// <param name="message">The text.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Error(this String message, String source = null, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Error, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs an error message to the console's standard error.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public static void Error(this String message, Type source, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Error, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs an error message to the console's standard error.
|
||||
/// </summary>
|
||||
/// <param name="ex">The exception.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Error(this Exception ex, String source, String message, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Error, message, source, ex, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion*/
|
||||
|
||||
#region Extended Public API
|
||||
|
||||
/*/// <summary>
|
||||
/// Logs the specified message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="messageType">Type of the message.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Log(this String message, String source, LogLevel messageType, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(messageType, message, source, extendedData, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs the specified message.
|
||||
/// </summary>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="messageType">Type of the message.</param>
|
||||
/// <param name="extendedData">The extended data.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public static void Log(this String message, Type source, LogLevel messageType, Object extendedData = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(messageType, message, source?.FullName, extendedData, callerMemberName, callerFilePath, callerLineNumber);*/
|
||||
#region Extended Public API
|
||||
|
||||
/// <summary>
|
||||
/// Logs an error message to the console's standard error.
|
||||
@@ -341,70 +41,7 @@ namespace Swan.Logging {
|
||||
// [Obsolete("NEED", false)]
|
||||
public static void Log(this Exception ex, String source = null, String message = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Error, message ?? ex.Message, source ?? ex.Source, ex, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/*/// <summary>
|
||||
/// Logs an error message to the console's standard error.
|
||||
/// </summary>
|
||||
/// <param name="ex">The ex.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Log(this Exception ex, Type source = null, String message = null, [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) => LogMessage(LogLevel.Error, message ?? ex.Message, source?.FullName ?? ex.Source, ex, callerMemberName, callerFilePath, callerLineNumber);
|
||||
|
||||
/// <summary>
|
||||
/// Logs a trace message showing all possible non-null properties of the given object
|
||||
/// This method is expensive as it uses Stringify internally.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="text">The title.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member. This is automatically populated.</param>
|
||||
/// <param name="callerFilePath">The caller file path. This is automatically populated.</param>
|
||||
/// <param name="callerLineNumber">The caller line number. This is automatically populated.</param>
|
||||
public static void Dump(this Object obj, String source, String text = "Object Dump", [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) {
|
||||
if(obj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String message = $"{text} ({obj.GetType()}): {Environment.NewLine}{obj.Stringify().Indent(5)}";
|
||||
LogMessage(LogLevel.Trace, message, source, obj, callerMemberName, callerFilePath, callerLineNumber);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs a trace message showing all possible non-null properties of the given object
|
||||
/// This method is expensive as it uses Stringify internally.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object.</param>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="text">The text.</param>
|
||||
/// <param name="callerMemberName">Name of the caller member.</param>
|
||||
/// <param name="callerFilePath">The caller file path.</param>
|
||||
/// <param name="callerLineNumber">The caller line number.</param>
|
||||
public static void Dump(this Object obj, Type source, String text = "Object Dump", [CallerMemberName] String callerMemberName = "", [CallerFilePath] String callerFilePath = "", [CallerLineNumber] Int32 callerLineNumber = 0) {
|
||||
if(obj == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String message = $"{text} ({obj.GetType()}): {Environment.NewLine}{obj.Stringify().Indent(5)}";
|
||||
LogMessage(LogLevel.Trace, message, source?.FullName, obj, callerMemberName, callerFilePath, callerLineNumber);
|
||||
}*/
|
||||
|
||||
#endregion
|
||||
|
||||
/*private static void RemoveLogger(Func<ILogger, Boolean> criteria) {
|
||||
lock(SyncLock) {
|
||||
ILogger loggerInstance = Loggers.FirstOrDefault(criteria);
|
||||
|
||||
if(loggerInstance == null) {
|
||||
throw new InvalidOperationException("The logger is not registered.");
|
||||
}
|
||||
|
||||
loggerInstance.Dispose();
|
||||
|
||||
_ = Loggers.Remove(loggerInstance);
|
||||
}
|
||||
}*/
|
||||
#endregion
|
||||
|
||||
// [Obsolete("NEED", false)]
|
||||
private static void LogMessage(LogLevel logLevel, String message, String sourceName, Object extendedData, String callerMemberName, String callerFilePath, Int32 callerLineNumber) {
|
||||
|
||||
Reference in New Issue
Block a user