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();
}
原文地址:https://www.cnblogs.com/chucklu/p/14958361.html