本文整理汇总了C#中ILogger.InsertLog方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.InsertLog方法的具体用法?C# ILogger.InsertLog怎么用?C# ILogger.InsertLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.InsertLog方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FilteredLog
private static void FilteredLog(ILogger logger, LogLevel level, string message, Exception exception = null, UserProfile customer = null)
{
//don't log thread abort exception
if ((exception != null) && (exception is System.Threading.ThreadAbortException))
return;
string fullMessage = exception == null ? string.Empty : exception.ToString();
logger.InsertLog(level, message, fullMessage, customer);
}
示例2: FilteredLog
private static void FilteredLog(ILogger logger, LogLevel level, string message, Exception exception = null, Customer customer = null)
{
//don't log thread abort exception
if (exception is System.Threading.ThreadAbortException)
return;
if (logger.IsEnabled(level))
{
string fullMessage = exception == null ? string.Empty : exception.ToString();
logger.InsertLog(level, message, fullMessage, customer);
}
}
示例3: FilteredLog
private static void FilteredLog(ILogger logger, LogLevel level, string message, Exception exception = null,
User user = null)
{
//No se guarda el registro cuando es de un hilo de una excepcion de abort
if (exception is ThreadAbortException)
return;
if (logger.IsEnabled(level))
{
var fullMessage = exception == null ? string.Empty : exception.ToString();
logger.InsertLog(level, message, fullMessage, user);
}
}
示例4: FilteredLog
private static void FilteredLog(ILogger logger, LogLevel level, string message,
Exception exception = null, Customer customer = null, bool stopException = true)
{
// không log thông điệp khi ngoại lệ là ThreadAbortException
if (exception is ThreadAbortException) return;
try
{
if (logger.IsEnabled(level)) // nếu cho phép ghi log với kiểu level
{
string fullMessage = exception == null ? string.Empty : exception.ToString();
logger.InsertLog(level, message, fullMessage, customer);
}
}
catch (Exception)
{
if (!stopException) throw;
}
}
示例5: FilteredLog
private static void FilteredLog(ILogger logger, LogLevel level, string message, Exception exception = null, string user = null)
{
logger.InsertLog(level, message, string.Empty, exception, user);
}