CMS.EventLog.EventLogProvider LogInformation(string source, string eventCode, string eventDescription = "")

LogInformation(string source, string eventCode, string eventDescription = "")

复制代码
// CMS.EventLog.EventLogProvider
/// <summary>
/// Writes a new information to the event log.
/// </summary>
/// <param name="source">Source of the event (Content, Administration, etc.)</param>
/// <param name="eventCode">Event code (Security, Update, Delete, etc.)</param>
/// <param name="eventDescription">Additional event information</param>
// Token: 0x060000E1 RID: 225 RVA: 0x00004484 File Offset: 0x00003484
public static void LogInformation(string source, string eventCode, string eventDescription = "")
{
    EventLogProvider.SafelyExecuteLogging(delegate
    {
        EventLogInfo eventObject = new EventLogInfo("I", source, eventCode)
        {
            EventDescription = eventDescription
        };
        EventLogProvider.LogEvent(eventObject);
    });
}
复制代码

 

复制代码
// CMS.EventLog.EventLogProvider
/// <summary>
/// Writes a new record to the event log.
/// </summary>
/// <param name="eventObject">Event object.</param>
// Token: 0x060000DC RID: 220 RVA: 0x000043AF File Offset: 0x000033AF
public static EventLogInfo LogEvent(EventLogInfo eventObject)
{
    return EventLogProvider.LogEventCore(eventObject, false);
}
复制代码

 

复制代码
// CMS.EventLog.EventLogProvider
/// <summary>
/// Writes a new record to the event log.
/// </summary>
/// <param name="eventObject">Event object.</param>
/// <param name="logDirectly">If true, the event is logged directly to the database. Otherwise, the event is logged to the queue processed by background worker to optimize performance.</param>
// Token: 0x060000DD RID: 221 RVA: 0x000043B8 File Offset: 0x000033B8
internal static EventLogInfo LogEventCore(EventLogInfo eventObject, bool logDirectly)
{
    try
    {
        using (new EventLoggingContext
        {
            EventLoggingInProgress = true
        })
        {
            return AbstractInfoProvider<EventLogInfo, EventLogProvider, ObjectQuery<EventLogInfo>>.ProviderObject.LogEventInternal(eventObject, logDirectly);
        }
    }
    catch (Exception ex)
    {
        if (EventLoggingContext.CurrentEventLoggingInProgress)
        {
            throw;
        }
        EventLogProvider.CannotLogEvent(ex);
    }
    return eventObject;
}
复制代码

 

 

if (!logDirectly)
        {
            EventLoggingContext.CurrentLogWorker.Enqueue(eventObject, DatabaseHelper.IsDatabaseAvailable);
        }

复制代码
// CMS.EventLog.EventLogProvider
/// <summary>
/// Writes a new record to the event log.
/// </summary>
/// <param name="eventObject">Contains event</param>
/// <param name="logDirectly">If true, the event is logged directly to the database. Otherwise, the event is logged to the queue processed by background worker to optimize performance.</param>
// Token: 0x060000E3 RID: 227 RVA: 0x000044CC File Offset: 0x000034CC
protected virtual EventLogInfo LogEventInternal(EventLogInfo eventObject, bool logDirectly)
{
    if (!AbstractInfoProvider<EventLogInfo, EventLogProvider, ObjectQuery<EventLogInfo>>.ProviderObject.CanLogEvent(eventObject, logDirectly))
    {
        return null;
    }
    string arg = string.Format("EventLogInfo{{EventType:{0},Source:{1},EventCode:{2}}}", eventObject.EventType, eventObject.Source, eventObject.EventCode);
    EventLogInfo result;
    using (RecursionControl recursionControl = new RecursionControl(string.Format("LogEventInternal({0},{1},bool)", arg, logDirectly), false))
    {
        if (!recursionControl.Continue)
        {
            throw new EventLoggingRecursionException("A recursive call to EventLogProvider.LogEventInternal has been detected.");
        }
        try
        {
            eventObject.EnsureEventData();
        }
        catch (EventLoggingRecursionException exception)
        {
            this.AddRecursionInformation(eventObject, exception);
        }
        if (!logDirectly)
        {
            EventLoggingContext.CurrentLogWorker.Enqueue(eventObject, DatabaseHelper.IsDatabaseAvailable);
        }
        else
        {
            EventLogProvider.IncrementEventCounters(eventObject);
            eventObject = AbstractInfoProvider<EventLogInfo, EventLogProvider, ObjectQuery<EventLogInfo>>.ProviderObject.LogEventInternal(eventObject);
        }
        result = eventObject;
    }
    return result;
}
复制代码

 

复制代码
// CMS.Base.ThreadQueueWorker<TItem, TWorker>
/// <summary>
/// Returns the first item in the queue and removes it
/// </summary>
// Token: 0x060007B6 RID: 1974 RVA: 0x00012498 File Offset: 0x00010698
private TItem Dequeue()
{
    object syncRoot = this.SyncRoot;
    TItem result;
    lock (syncRoot)
    {
        result = this.mQueue.Dequeue();
    }
    return result;
}
复制代码

 

复制代码
// CMS.Base.ThreadQueueWorker<TItem, TWorker>
/// <summary>
/// Gets the queued items to process.
/// </summary>
// Token: 0x060007B9 RID: 1977 RVA: 0x00012558 File Offset: 0x00010758
private IEnumerable<TItem> FetchItemsToProcess()
{
    while (this.ItemsInQueue > 0)
    {
        TItem titem = this.Dequeue();
        if (titem != null)
        {
            yield return titem;
        }
    }
    yield break;
}
复制代码

 

复制代码
// CMS.Base.ThreadQueueWorker<TItem, TWorker>
/// <summary>
/// Method processing queued actions.
/// </summary>
// Token: 0x060007B7 RID: 1975 RVA: 0x000124E0 File Offset: 0x000106E0
protected sealed override void Process()
{
    this.Process(this.FetchItemsToProcess());
}
复制代码

 

复制代码
// CMS.Base.ThreadWorker<T>
/// <summary>
/// Runs the internal process of the worker
/// </summary>
// Token: 0x06000791 RID: 1937 RVA: 0x00011EE0 File Offset: 0x000100E0
protected void RunProcess()
{
    bool flag = false;
    try
    {
        Monitor.TryEnter(this.runLock, 0, ref flag);
        if (flag)
        {
            this.Process();
        }
    }
    catch
    {
    }
    finally
    {
        if (flag)
        {
            Monitor.Exit(this.runLock);
        }
    }
}
复制代码

 

复制代码
// CMS.EventLog.EventLogWorker
/// <summary>
/// Finishes processing all the items remaining in the worker queue
/// </summary>
// Token: 0x06000025 RID: 37 RVA: 0x000024C4 File Offset: 0x000014C4
protected override void Finish()
{
    base.RunProcess();
}
复制代码

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(54)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2020-07-01 Windows Service: System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the re
2020-07-01 Requested registry access is not allowed
2020-07-01 What is the benefit of developing the application as a windows service?
2020-07-01 Create user 创建用户 win10
2020-07-01 Can I see my edit suggestions?
2020-07-01 普通话异读词审音表
2020-07-01 System.Diagnostics.Process.Start(ProcessStartInfo)
点击右上角即可分享
微信分享提示