/// <summary> /// Initializes a new instance of the <see cref="T:log4net.Core.LoggingEvent" /> class /// using specific data. /// </summary> /// <param name="callerStackBoundaryDeclaringType">The declaring type of the method that is /// the stack boundary into the logging system for this call.</param> /// <param name="repository">The repository this event is logged in.</param> /// <param name="data">Data used to initialize the logging event.</param> /// <param name="fixedData">The fields in the <paranref name="data" /> struct that have already been fixed.</param> /// <remarks> /// <para> /// This constructor is provided to allow a <see cref="T:log4net.Core.LoggingEvent" /> /// to be created independently of the log4net framework. This can /// be useful if you require a custom serialization scheme. /// </para> /// <para> /// Use the <see cref="M:GetLoggingEventData(FixFlags)" /> method to obtain an /// instance of the <see cref="T:log4net.Core.LoggingEventData" /> class. /// </para> /// <para> /// The <paramref name="fixedData" /> parameter should be used to specify which fields in the /// <paramref name="data" /> struct have been preset. Fields not specified in the <paramref name="fixedData" /> /// will be captured from the environment if requested or fixed. /// </para> /// </remarks> public LoggingEvent(Type callerStackBoundaryDeclaringType, ILoggerRepository repository, LoggingEventData data, FixFlags fixedData) { m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; m_repository = repository; m_data = data; m_fixFlags = fixedData; }
public BasicLoggingEventParser(string machineName, FixFlags fixedFields, bool serializeObjects, IJsonSerializableExceptionFactory exceptionFactory) { _machineName = machineName; _fixedFields = fixedFields; _serializeObjects = serializeObjects; _exceptionFactory = exceptionFactory; }
public LoggingEventData GetLoggingEventData(FixFlags fixFlags) { // 设置 FixFlag 的时候,顺便把数据全部缓存在 m_data 的属性字典里了,所以这里可以直接返回 m_data Fix = fixFlags; return(m_data); }
public void SelectedPreset_ShouldConfigureFixesCorrecly(string value, FixFlags expected) { mSut.SelectedPreset = value; FixFlags enabled = mSut.Fixes.Where(fix => fix.Enabled).Aggregate(FixFlags.None, (current, fix) => current | fix.Flag); Assert.AreEqual(expected, enabled); }
/// <summary> /// Configures the root appender for counting and rolling /// </summary> private void ConfigureRootAppender(FixFlags fixFlags) { log4net.Repository.Hierarchy.Logger root = null; root = ((log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository()).Root; root.Level = Level.Debug; root.AddAppender(CreateAppender(fixFlags)); root.Repository.Configured = true; }
public LoggingEvent(Type callerStackBoundaryDeclaringType, ILoggerRepository repository, LoggingEventData data, FixFlags fixedData) { this.m_cacheUpdatable = true; this.m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; this.m_repository = repository; this.m_data = data; this.m_fixFlags = fixedData; }
/// <summary> /// Write the provided logging event to the central Gibraltar log. /// </summary> /// <remarks> /// <para>The central Gibraltar logging class (Log) makes common decisions about when to write out logging information /// and where to write it out, therefore not all Log4Net logging events may be chosen to be permanently recorded</para> /// <para>Required as part of the Log4Net IAppender interface implementation.</para></remarks> /// <param name="loggingEvent">The individual LoggingEvent to be appended.</param> protected override void Append(LoggingEvent loggingEvent) { // We shouldn't need a lock in this method because we don't access any of our member variables here, // and we don't need a recursion-guard because we don't send our own log events through log4net. // But we do need to first make sure the information we need is available from the LoggingEvent. // If it hasn't had any Fix flags set then we should be clear to access them without doing a Fix. const FixFlags ourFixFlags = FixFlags.Message | FixFlags.LocationInfo // | FixFlags.UserName | FixFlags.Identity | FixFlags.Exception; FixFlags fixedFlags = loggingEvent.Fix; if (fixedFlags != FixFlags.None) { // Hmmm, someone already did a Fix on this LoggingEvent, which apparently locks other values from // being updated upon reference. So we need to make sure the ones we need are also "fixed". // But don't do this if the flags are None because we don't want to lock the loggingEvent against // being updated by other references if it isn't already. // ToDo: Find out if this is actually necessary or if we are guaranteed to get our own LoggingEvent // independent of any other appender. It seems odd that appenders could break each other this way. FixFlags neededFlags = ourFixFlags & ~fixedFlags; // What we need which isn't already fixed if (neededFlags != FixFlags.None) { // Uh-oh, there's something we do need to have "fixed" loggingEvent.Fix = ourFixFlags; // should we set both (ourFixFlags | FixFlags.Partial) ? // Flags that were already set are ignored in the new value, they can't change back to 0. } } LocationInfo locationInfo = loggingEvent.LocationInformation; IMessageSourceProvider messageSource = new LogMessageSource(locationInfo); // Wrap it with our converter Exception exception = loggingEvent.ExceptionObject; string loggerName = loggingEvent.LoggerName; string message = Layout != null?RenderLoggingEvent(loggingEvent) : loggingEvent.RenderedMessage; string userName = loggingEvent.Identity; if (string.IsNullOrEmpty(userName)) { // No thread-specific impersonating user, we'll just get the invariant process username later; userName = null; } // This is a slight hack. We get our repository from the first LoggingEvent we see after a config update // and use it to update our thresholds configuration. We are assuming each instance of an appender is // associated with only one repository (but might in general be attached to multiple loggers). // Notice that GibraltarMessageSeverity() will get the lock for access to our threshold config member variables. LogMessageSeverity severity = GibraltarMessageSeverity(loggingEvent.Level, loggingEvent.Repository); if (severity != LogMessageSeverity.None) // Filter out severities less than configured Verbose threshold { // We have a real event message. Log it to the central Gibraltar queue, tagged as from Log4Net Log.Write(severity, "Log4Net", messageSource, userName, exception, LogWriteMode.Queued, null, loggerName, null, message); } }
private void SetFixFlags(FixFlags newFixFlags) { if (newFixFlags != fixFlags) { loggingEventHelper.Fix = newFixFlags; fixFlags = newFixFlags; InitializeAppenders(); } }
protected void FixVolatileData(FixFlags flags) { object renderedMessage = null; this.m_cacheUpdatable = true; FixFlags flags2 = (flags ^ this.m_fixFlags) & flags; if (flags2 > FixFlags.None) { if ((flags2 & FixFlags.Message) != FixFlags.None) { renderedMessage = this.RenderedMessage; this.m_fixFlags |= FixFlags.Message; } if ((flags2 & FixFlags.ThreadName) != FixFlags.None) { renderedMessage = this.ThreadName; this.m_fixFlags |= FixFlags.ThreadName; } if ((flags2 & FixFlags.LocationInfo) != FixFlags.None) { renderedMessage = this.LocationInformation; this.m_fixFlags |= FixFlags.LocationInfo; } if ((flags2 & FixFlags.UserName) != FixFlags.None) { renderedMessage = this.UserName; this.m_fixFlags |= FixFlags.UserName; } if ((flags2 & FixFlags.Domain) != FixFlags.None) { renderedMessage = this.Domain; this.m_fixFlags |= FixFlags.Domain; } if ((flags2 & FixFlags.Identity) != FixFlags.None) { renderedMessage = this.Identity; this.m_fixFlags |= FixFlags.Identity; } if ((flags2 & FixFlags.Exception) != FixFlags.None) { renderedMessage = this.GetExceptionString(); this.m_fixFlags |= FixFlags.Exception; } if ((flags2 & FixFlags.Properties) != FixFlags.None) { this.CacheProperties(); this.m_fixFlags |= FixFlags.Properties; } } if (renderedMessage != null) { } this.m_cacheUpdatable = false; }
public void FixVolatileData(bool fastButLoose) { if (fastButLoose) { Fix = FixFlags.Partial; } else { Fix = FixFlags.All; } }
public void Load_ShouldLoadPresetCorrectly(string xml, FixFlags expectedFlags, string expectedPreset) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml("<appender name=\"asyncAppender\" type=\"Log4Net.Async.AsyncForwardingAppender,Log4Net.Async\">\n" + $" {xml}\n" + "</appender>"); mSut.Load(xmlDoc.FirstChild); Assert.AreEqual(expectedPreset, mSut.SelectedPreset); }
private void SetFixFlags(FixFlags newFixFlags) { if (newFixFlags != m_FixFlags) { if (m_LoggingEventHelper != null) { m_LoggingEventHelper.Fix = newFixFlags; } m_FixFlags = newFixFlags; InitializeAppenders(); } }
/// <summary> /// Fix the fields specified by the <see cref="T:log4net.Core.FixFlags" /> parameter /// </summary> /// <param name="flags">the fields to fix</param> /// <remarks> /// <para> /// Only fields specified in the <paramref name="flags" /> will be fixed. /// Fields will not be fixed if they have previously been fixed. /// It is not possible to 'unfix' a field. /// </para> /// </remarks> protected void FixVolatileData(FixFlags flags) { object obj = null; m_cacheUpdatable = true; FixFlags fixFlags = (flags ^ m_fixFlags) & flags; if (fixFlags > FixFlags.None) { if ((fixFlags & FixFlags.Message) != 0) { obj = RenderedMessage; m_fixFlags |= FixFlags.Message; } if ((fixFlags & FixFlags.ThreadName) != 0) { obj = ThreadName; m_fixFlags |= FixFlags.ThreadName; } if ((fixFlags & FixFlags.LocationInfo) != 0) { obj = LocationInformation; m_fixFlags |= FixFlags.LocationInfo; } if ((fixFlags & FixFlags.UserName) != 0) { obj = UserName; m_fixFlags |= FixFlags.UserName; } if ((fixFlags & FixFlags.Domain) != 0) { obj = Domain; m_fixFlags |= FixFlags.Domain; } if ((fixFlags & FixFlags.Identity) != 0) { obj = Identity; m_fixFlags |= FixFlags.Identity; } if ((fixFlags & FixFlags.Exception) != 0) { obj = GetExceptionString(); m_fixFlags |= FixFlags.Exception; } if ((fixFlags & FixFlags.Properties) != 0) { CacheProperties(); m_fixFlags |= FixFlags.Properties; } } m_cacheUpdatable = false; }
private static RemotingAppender CreateAppender(FixFlags fixFlags) { RemotingAppender appender = new RemotingAppender(); appender.Sink = "tcp://localhost:8085/LoggingSink"; appender.Lossy = false; appender.BufferSize = 1; appender.Fix = fixFlags; appender.ActivateOptions(); return(appender); }
private static void PerformLoggingWithFixOption(FixFlags fixFlags) { var appender = new log4net.Appender.HtmlSmtpAppender() { Name = "TestInstance", To = "*****@*****.**", From = "*****@*****.**", Fix = fixFlags, }; appender.ActivateOptions(); BasicConfigurator.Configure(appender); }
public void Load_ShouldLoadFixesCorrectly(string xml, FixFlags expectedFlags, string expectedPreset) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml("<appender name=\"asyncAppender\" type=\"Log4Net.Async.AsyncForwardingAppender,Log4Net.Async\">\n" + $" {xml}\n" + "</appender>"); mSut.Load(xmlDoc.FirstChild); FixFlags enabled = mSut.Fixes.Where(fix => fix.Enabled).Aggregate(FixFlags.None, (current, fix) => current | fix.Flag); Assert.AreEqual(expectedFlags, enabled); }
/// <summary> /// Serialization constructor /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> /// <remarks> /// <para> /// Initializes a new instance of the <see cref="T:log4net.Core.LoggingEvent" /> class /// with serialized data. /// </para> /// </remarks> protected LoggingEvent(SerializationInfo info, StreamingContext context) { m_data.LoggerName = info.GetString("LoggerName"); m_data.Level = (Level)info.GetValue("Level", typeof(Level)); m_data.Message = info.GetString("Message"); m_data.ThreadName = info.GetString("ThreadName"); m_data.TimeStampUtc = info.GetDateTime("TimeStamp").ToUniversalTime(); m_data.LocationInfo = (LocationInfo)info.GetValue("LocationInfo", typeof(LocationInfo)); m_data.UserName = info.GetString("UserName"); m_data.ExceptionString = info.GetString("ExceptionString"); m_data.Properties = (PropertiesDictionary)info.GetValue("Properties", typeof(PropertiesDictionary)); m_data.Domain = info.GetString("Domain"); m_data.Identity = info.GetString("Identity"); m_fixFlags = FixFlags.All; }
protected LoggingEvent(SerializationInfo info, StreamingContext context) { this.m_cacheUpdatable = true; this.m_data.LoggerName = info.GetString("LoggerName"); this.m_data.Level = (log4net.Core.Level)info.GetValue("Level", typeof(log4net.Core.Level)); this.m_data.Message = info.GetString("Message"); this.m_data.ThreadName = info.GetString("ThreadName"); this.m_data.TimeStamp = info.GetDateTime("TimeStamp"); this.m_data.LocationInfo = (LocationInfo)info.GetValue("LocationInfo", typeof(LocationInfo)); this.m_data.UserName = info.GetString("UserName"); this.m_data.ExceptionString = info.GetString("ExceptionString"); this.m_data.Properties = (PropertiesDictionary)info.GetValue("Properties", typeof(PropertiesDictionary)); this.m_data.Domain = info.GetString("Domain"); this.m_data.Identity = info.GetString("Identity"); this.m_fixFlags = FixFlags.All; }
public void Save_ShouldSaveCorrectly(FixFlags flags) { XmlDocument xmlDoc = new XmlDocument(); XmlElement appender = xmlDoc.CreateElement("appender"); foreach (FixModel fixModel in mSut.Fixes) { fixModel.Enabled = flags.HasFlag(fixModel.Flag); } mSut.Save(xmlDoc, appender); XmlNode fixNode = appender.SelectSingleNode("Fix"); Assert.IsNotNull(fixNode); Assert.AreEqual(((int)flags).ToString(), fixNode.Attributes?["value"].Value); }
/// <summary> /// Initializes a new instance of the <see cref="LoggingEvent" /> class /// using specific data. /// </summary> /// <param name="callerStackBoundaryDeclaringType">The declaring type of the method that is /// the stack boundary into the logging system for this call.</param> /// <param name="repository">The repository this event is logged in.</param> /// <param name="data">Data used to initialize the logging event.</param> /// <param name="fixedData">The fields in the <paranref name="data"/> struct that have already been fixed.</param> /// <remarks> /// <para> /// This constructor is provided to allow a <see cref="LoggingEvent" /> /// to be created independently of the log4net framework. This can /// be useful if you require a custom serialization scheme. /// </para> /// <para> /// Use the <see cref="GetLoggingEventData(FixFlags)"/> method to obtain an /// instance of the <see cref="LoggingEventData"/> class. /// </para> /// <para> /// The <paramref name="fixedData"/> parameter should be used to specify which fields in the /// <paramref name="data"/> struct have been preset. Fields not specified in the <paramref name="fixedData"/> /// will be captured from the environment if requested or fixed. /// </para> /// </remarks> public LoggingEvent(Type callerStackBoundaryDeclaringType, log4net.Repository.ILoggerRepository repository, LoggingEventData data, FixFlags fixedData) { m_callerStackBoundaryDeclaringType = callerStackBoundaryDeclaringType; m_repository = repository; m_data = data; m_fixFlags = fixedData; }
/// <summary> /// Gets the portable data for this <see cref="LoggingEvent" />. /// </summary> /// <param name="fixFlags">The set of data to ensure is fixed in the LoggingEventData</param> /// <returns>The <see cref="LoggingEventData"/> for this event.</returns> /// <remarks> /// <para> /// A new <see cref="LoggingEvent"/> can be constructed using a /// <see cref="LoggingEventData"/> instance. /// </para> /// </remarks> public LoggingEventData GetLoggingEventData(FixFlags fixFlags) { Fix = fixFlags; return m_data; }
private RemotingAppender CreateAppender(FixFlags fixFlags) { RemotingAppender appender = new RemotingAppender(); appender.Sink = "tcp://localhost:8085/LoggingSink"; appender.Lossy = false; appender.BufferSize = 1; appender.Fix = fixFlags; appender.ActivateOptions(); return appender; }
public virtual void Configure(ILogEventFactoryParams appenderProperties) { FixedFields = appenderProperties.FixedFields; SerializeObjects = appenderProperties.SerializeObjects; }
public LogEventFactoryParams(FixFlags fixedFields, bool serializeObjects) { FixedFields = fixedFields; SerializeObjects = serializeObjects; }
/// <summary> /// Fix the fields specified by the <see cref="FixFlags"/> parameter /// </summary> /// <param name="flags">the fields to fix</param> /// <remarks> /// Only fields specified in the <paramref name="flags"/> will be fixed. /// Fields will not be fixed if they have previously been fixed. /// It is not possible to 'unfix' a field. /// </remarks> protected void FixVolatileData(FixFlags flags) { // determine the flags that we are actually fixing FixFlags updateFlags = (FixFlags)((flags ^ m_fixFlags) & flags); if (updateFlags > 0) { if ((updateFlags & FixFlags.Mdc) != 0) { // Force the MDC to be cached CacheMappedContext(); m_fixFlags |= FixFlags.Mdc; } if ((updateFlags & FixFlags.Ndc) != 0) { // Force the NDC to be cached string tmp = this.NestedContext; m_fixFlags |= FixFlags.Ndc; } if ((updateFlags & FixFlags.Message) != 0) { // Force the message to be rendered string tmp = this.RenderedMessage; m_fixFlags |= FixFlags.Message; } if ((updateFlags & FixFlags.Message) != 0) { // Force the message to be rendered string tmp = this.RenderedMessage; m_fixFlags |= FixFlags.Message; } if ((updateFlags & FixFlags.ThreadName) != 0) { // Grab the thread name string tmp = this.ThreadName; m_fixFlags |= FixFlags.ThreadName; } if ((updateFlags & FixFlags.LocationInfo) != 0) { // Force the location information to be loaded LocationInfo lo = this.LocationInformation; m_fixFlags |= FixFlags.LocationInfo; } if ((updateFlags & FixFlags.UserName) != 0) { // Grab the user name string tmp = this.UserName; m_fixFlags |= FixFlags.UserName; } if ((updateFlags & FixFlags.Domain) != 0) { // Grab the domain name string tmp = this.Domain; m_fixFlags |= FixFlags.Domain; } if ((updateFlags & FixFlags.Identity) != 0) { // Grab the identity string tmp = this.Identity; m_fixFlags |= FixFlags.Identity; } if ((updateFlags & FixFlags.Exception) != 0) { // Force the exception text to be loaded string tmp = GetExceptionStrRep(); m_fixFlags |= FixFlags.Exception; } } }
public BasicLogEventConverter(FixFlags fixedFields, bool serializeObjects) : this(new BasicLoggingEventParser(Environment.MachineName, fixedFields, serializeObjects)) { }
public void FixVolatileData() { Fix = FixFlags.All; }
/// <summary> /// Gets the portable data for this <see cref="T:log4net.Core.LoggingEvent" />. /// </summary> /// <param name="fixFlags">The set of data to ensure is fixed in the LoggingEventData</param> /// <returns>The <see cref="T:log4net.Core.LoggingEventData" /> for this event.</returns> /// <remarks> /// <para> /// A new <see cref="T:log4net.Core.LoggingEvent" /> can be constructed using a /// <see cref="T:log4net.Core.LoggingEventData" /> instance. /// </para> /// </remarks> public LoggingEventData GetLoggingEventData(FixFlags fixFlags) { Fix = fixFlags; return(m_data); }
public ILogEventConverter Create(FixFlags fixedFields, bool serializeObjects) { return(new BasicLogEventConverter(fixedFields, serializeObjects)); }
public static bool ContainsFlag(this FixFlags flagsEnum, FixFlags flag) { return((flagsEnum & flag) != 0); }
public BlockingLoggingEvent(Type callerStackBoundaryDeclaringType, ILoggerRepository repository, LoggingEventData data, FixFlags fixedData) : base(callerStackBoundaryDeclaringType, repository, data, fixedData) { }
public LoggingEventHelper(string loggerName, FixFlags fix) { this.loggerName = loggerName; Fix = fix; }
/// <summary> /// Initializes a new instance of the <see cref="QyfAsyncAppender" /> class. /// </summary> /// <remarks> /// <para> /// Default constructor. /// </para> /// </remarks> public QyfAsyncAppender() { _errorHandler = new OnlyOnceErrorHandler(GetType().Name); _eventQueue = new List<LoggingEvent>(); _fixedFields = FixFlags.Partial; _asyncForward = new Thread(AsyncForwarder) { IsBackground = true }; _asyncForward.Start(); DeclareInstance(this); }
/// <summary> /// Fix the fields specified by the <see cref="FixFlags"/> parameter /// </summary> /// <param name="flags">the fields to fix</param> /// <remarks> /// <para> /// Only fields specified in the <paramref name="flags"/> will be fixed. /// Fields will not be fixed if they have previously been fixed. /// It is not possible to 'unfix' a field. /// </para> /// </remarks> protected void FixVolatileData(FixFlags flags) { // determine the flags that we are actually fixing FixFlags updateFlags = (FixFlags)((flags ^ m_fixFlags) & flags); if (updateFlags > 0) { if ((updateFlags & FixFlags.Message) != 0) { // Force the message to be rendered string forceCreation = this.RenderedMessage; m_fixFlags |= FixFlags.Message; } if ((updateFlags & FixFlags.Message) != 0) { // Force the message to be rendered string forceCreation = this.RenderedMessage; m_fixFlags |= FixFlags.Message; } if ((updateFlags & FixFlags.ThreadName) != 0) { // Grab the thread name string forceCreation = this.ThreadName; m_fixFlags |= FixFlags.ThreadName; } if ((updateFlags & FixFlags.LocationInfo) != 0) { // Force the location information to be loaded LocationInfo forceCreation = this.LocationInformation; m_fixFlags |= FixFlags.LocationInfo; } if ((updateFlags & FixFlags.UserName) != 0) { // Grab the user name string forceCreation = this.UserName; m_fixFlags |= FixFlags.UserName; } if ((updateFlags & FixFlags.Domain) != 0) { // Grab the domain name string forceCreation = this.Domain; m_fixFlags |= FixFlags.Domain; } if ((updateFlags & FixFlags.Identity) != 0) { // Grab the identity string forceCreation = this.Identity; m_fixFlags |= FixFlags.Identity; } if ((updateFlags & FixFlags.Exception) != 0) { // Force the exception text to be loaded string forceCreation = GetExceptionString(); m_fixFlags |= FixFlags.Exception; } if ((updateFlags & FixFlags.Properties) != 0) { CacheProperties(); m_fixFlags |= FixFlags.Properties; } } }
public FixModel(FixFlags flag, bool performanceImpact, string description = null) { Flag = flag; PerformanceImpact = performanceImpact; Description = description; }
public BasicLoggingEventParser(string machineName, FixFlags fixedFields, bool serializeObjects) : this(machineName, fixedFields, serializeObjects, new BasicJsonSerializableExceptionFactory()) { }
/// <summary> /// Fix the fields specified by the <see cref="FixFlags"/> parameter /// </summary> /// <param name="flags">the fields to fix</param> /// <remarks> /// <para> /// Only fields specified in the <paramref name="flags"/> will be fixed. /// Fields will not be fixed if they have previously been fixed. /// It is not possible to 'unfix' a field. /// </para> /// </remarks> protected void FixVolatileData(FixFlags flags) { object forceCreation = null; //Unlock the cache so that new values can be stored //This may not be ideal if we are no longer in the correct context //and someone calls fix. m_cacheUpdatable=true; // determine the flags that we are actually fixing FixFlags updateFlags = (FixFlags)((flags ^ m_fixFlags) & flags); if (updateFlags > 0) { if ((updateFlags & FixFlags.Message) != 0) { // Force the message to be rendered forceCreation = this.RenderedMessage; m_fixFlags |= FixFlags.Message; } if ((updateFlags & FixFlags.ThreadName) != 0) { // Grab the thread name forceCreation = this.ThreadName; m_fixFlags |= FixFlags.ThreadName; } if ((updateFlags & FixFlags.LocationInfo) != 0) { // Force the location information to be loaded forceCreation = this.LocationInformation; m_fixFlags |= FixFlags.LocationInfo; } if ((updateFlags & FixFlags.UserName) != 0) { // Grab the user name forceCreation = this.UserName; m_fixFlags |= FixFlags.UserName; } if ((updateFlags & FixFlags.Domain) != 0) { // Grab the domain name forceCreation = this.Domain; m_fixFlags |= FixFlags.Domain; } if ((updateFlags & FixFlags.Identity) != 0) { // Grab the identity forceCreation = this.Identity; m_fixFlags |= FixFlags.Identity; } if ((updateFlags & FixFlags.Exception) != 0) { // Force the exception text to be loaded forceCreation = GetExceptionString(); m_fixFlags |= FixFlags.Exception; } if ((updateFlags & FixFlags.Properties) != 0) { CacheProperties(); m_fixFlags |= FixFlags.Properties; } } // avoid warning CS0219 if (forceCreation != null) { } //Finaly lock everything we've cached. m_cacheUpdatable=false; }
/// <summary> /// Gets the portable data for this <see cref="LoggingEvent" />. /// </summary> /// <remarks> /// <para> /// A new <see cref="LoggingEvent"/> can be constructed using a /// <see cref="LoggingEventData"/> instance.</para> /// </remarks> /// <returns>The <see cref="LoggingEventData"/> for this event.</returns> public LoggingEventData GetLoggingEventData() { Fix = FixFlags.Partial; return m_data; }
public static bool ContainsFlag(this FixFlags flagsEnum, FixFlags flag) { return (flagsEnum & flag) != 0; }