Serilog Create properties based on an ordered list of provided values. The template that the parameters apply to. Objects corresponding to the properties represented in the message template. A list of properties; if the template is malformed then this will be empty. Implemented on types that apply settings to a logger configuration. Apply the settings to the logger configuration. The logger configuration to apply settings to. Controls audit sink configuration. Audit log events to the specified . The sink. The minimum level for events passed through the sink. Ignored when is specified. A switch allowing the pass-through minimum level to be changed at runtime. Configuration object allowing method chaining. Audit log events to the specified . The sink. The minimum level for events passed through the sink. Ignored when is specified. A switch allowing the pass-through minimum level to be changed at runtime. Configuration object allowing method chaining. Audit log events to a sub-logger, where further processing may occur. Events through the sub-logger will be constrained by filters and enriched by enrichers that are active in the parent. A sub-logger cannot be used to log at a more verbose level, but a less verbose level is possible. An action that configures the sub-logger. The minimum level for events passed through the sink. Ignored when is specified. A switch allowing the pass-through minimum level to be changed at runtime. Configuration object allowing method chaining. Audit log events to a sub-logger, where further processing may occur. Events through the sub-logger will be constrained by filters and enriched by enrichers that are active in the parent. A sub-logger cannot be used to log at a more verbose level, but a less verbose level is possible. The sub-logger. This will not be shut down automatically when the parent logger is disposed. The minimum level for events passed through the sink. Configuration object allowing method chaining. Controls template parameter destructuring configuration. Treat objects of the specified type as scalar values, i.e., don't break them down into properties even when destructuring complex types. Type to treat as scalar. Configuration object allowing method chaining. When is null Treat objects of the specified type as scalar values, i.e., don't break them down into properties even when destructuring complex types. Type to treat as scalar. Configuration object allowing method chaining. When destructuring objects, transform instances with the provided policies. Policies to apply when destructuring. Configuration object allowing method chaining. When is null When any element of is null When destructuring objects, transform instances with the provided policy. Policy to apply when destructuring. Configuration object allowing method chaining. Capture instances of the specified type as dictionaries. By default, only concrete instantiations of are considered dictionary-like. Type of dictionary. Configuration object allowing method chaining. When destructuring objects, transform instances of the specified type with the provided function. Function mapping instances of to an alternative representation. Type of values to transform. Configuration object allowing method chaining. When is null When destructuring objects, transform instances of the specified type with the provided function, if the predicate returns true. Be careful to avoid any intensive work in the predicate, as it can slow down the pipeline significantly. A predicate used to determine if the transform applies to a specific type of value Function mapping instances of to an alternative representation. Type of values to transform. Configuration object allowing method chaining. When is null When is null When destructuring objects, depth will be limited to 10 property traversals deep to guard against ballooning space when recursive/cyclic structures are accidentally passed. To change this limit pass a new maximum depth. The maximum depth to use. Configuration object allowing method chaining. When is negative When destructuring objects, string values can be restricted to specified length thus avoiding bloating payload. Limit is applied to each value separately, sum of length of strings can exceed limit. The maximum string length. Configuration object allowing method chaining. When is less than 2 When destructuring objects, collections be restricted to specified count thus avoiding bloating payload. Limit is applied to each collection separately, sum of length of collection can exceed limit. Applies limit to all including dictionaries. Configuration object allowing method chaining. When is less than 1 Controls enrichment configuration. Specifies one or more enrichers that may add properties dynamically to log events. Enrichers to apply to all events passing through the logger. Configuration object allowing method chaining. When is null When any element of is null Specifies an enricher that may add properties dynamically to log events. Enricher type to apply to all events passing through the logger. Configuration object allowing method chaining. Include the specified property value in all events logged to the logger. The name of the property to add. The property value to add. If , objects of unknown type will be logged as structures; otherwise they will be converted using . Configuration object allowing method chaining. Enrich log events with properties from . Configuration object allowing method chaining. Configuration object allowing method chaining. Apply an enricher only when evaluates to true. A predicate that evaluates to true when the supplied should be enriched. An action that configures the wrapped enricher. Configuration object allowing method chaining. When is null When is null Apply an enricher only to events with a greater than or equal to . The level from which the enricher will be applied. An action that configures the wrapped enricher. Configuration object allowing method chaining. This method permits additional information to be attached to e.g. warnings and errors, that might be too expensive to collect or store at lower levels. When is null Apply an enricher only to events with a greater than or equal to the level specified by . A that specifies the level from which the enricher will be applied. An action that configures the wrapped enricher. Configuration object allowing method chaining. This method permits additional information to be attached to e.g. warnings and errors, that might be too expensive to collect or store at lower levels. When is null Helper method for wrapping sinks. The parent enrichment configuration. A function that allows for wrapping s added in . An action that configures enrichers to be wrapped in . Configuration object allowing method chaining. When is null When is null When is null Controls filter configuration. Filter out log events from the stream based on the provided filter. The filters to apply. Configuration object allowing method chaining. When is null When any element of is null Filter out log events from the stream based on the provided filter. The filters to apply. Configuration object allowing method chaining. Filter out log events that match a predicate. Function that returns true when an event should be excluded (silenced). Configuration object allowing method chaining. Filter log events to include only those that match a predicate. Function that returns true when an event should be included (emitted). Configuration object allowing method chaining. Controls sink configuration. Sets the minimum level at which events will be passed to sinks. The minimum level to set. Configuration object allowing method chaining. Sets the minimum level to be dynamically controlled by the provided switch. The switch. Configuration object allowing method chaining. When is null Anything and everything you might want to know about a running block of code. Configuration object allowing method chaining. Internal system events that aren't necessarily observable from the outside. Configuration object allowing method chaining. The lifeblood of operational intelligence - things happen. Configuration object allowing method chaining. Service is degraded or endangered. Configuration object allowing method chaining. Functionality is unavailable, invariants are broken or data is lost. Configuration object allowing method chaining. If you have a pager, it goes off when one of these occurs. Configuration object allowing method chaining. Override the minimum level for events from a specific namespace or type name. This API is not supported for configuring sub-loggers (created through ). Use or instead. You also might consider using https://github.com/serilog/serilog-filters-expressions. The (partial) namespace or type name to set the override for. The switch controlling loggers for matching sources. Configuration object allowing method chaining. When is null When a trimmed is empty When is null Override the minimum level for events from a specific namespace or type name. This API is not supported for configuring sub-loggers (created through ). Use or instead. You also might consider using https://github.com/serilog/serilog-filters-expressions. The (partial) namespace or type name to set the override for. The minimum level applied to loggers for matching sources. Configuration object allowing method chaining. When is null Allows additional setting sources to drive the logger configuration. Apply external settings to the logger configuration. Configuration object allowing method chaining. When is null Apply settings specified in the Serilog key-value setting format to the logger configuration. A list of key-value pairs describing logger settings. Configuration object allowing method chaining. In case of duplicate keys, the last value for the key is kept and the previous ones are ignored. When is null Controls sink configuration. Write log events to the specified . The sink. The minimum level for events passed through the sink. Configuration object allowing method chaining. Sink configuration methods that specify should also specify . Write log events to the specified . The sink. The minimum level for events passed through the sink. Ignored when is specified. A switch allowing the pass-through minimum level to be changed at runtime. Configuration object allowing method chaining. Write log events to the specified . The sink. The minimum level for events passed through the sink. Ignored when is specified. A switch allowing the pass-through minimum level to be changed at runtime. Configuration object allowing method chaining. Write log events to a sub-logger, where further processing may occur. Events through the sub-logger will be constrained by filters and enriched by enrichers that are active in the parent. A sub-logger cannot be used to log at a more verbose level, but a less verbose level is possible. An action that configures the sub-logger. The minimum level for events passed through the sink. Ignored when is specified. A switch allowing the pass-through minimum level to be changed at runtime. Can be null Configuration object allowing method chaining. When is null Write log events to a sub-logger, where further processing may occur. Events through the sub-logger will be constrained by filters and enriched by enrichers that are active in the parent. A sub-logger cannot be used to log at a more verbose level, but a less verbose level is possible. The sub-logger. This will not be shut down automatically when the parent logger is disposed. The minimum level for events passed through the sink. Configuration object allowing method chaining. When is null Write log events to a sub-logger, where further processing may occur. Events through the sub-logger will be constrained by filters and enriched by enrichers that are active in the parent. A sub-logger cannot be used to log at a more verbose level, but a less verbose level is possible. The sub-logger. Whether to shut down automatically the sub-logger when the parent logger is disposed. The minimum level for events passed through the sink. A switch allowing the pass-through minimum level to be changed at runtime. Can be null Configuration object allowing method chaining. When is null Write to a sink only when evaluates to true. A predicate that evaluates to true when the supplied should be written to the configured sink. An action that configures the wrapped sink. Configuration object allowing method chaining. When is null When is null Helper method for wrapping sinks. The parent sink configuration. A function that allows for wrapping s added in . An action that configures sinks to be wrapped in . The minimum level for events passed through the sink. Ignored when is specified. A switch allowing the pass-through minimum level to be changed at runtime. Can be null Configuration object allowing method chaining. When is null When is null When is null Holds ambient properties that can be attached to log events. To configure, use the method. Configuration: var log = new LoggerConfiguration() .Enrich.FromLogContext() ... Usage: using (LogContext.PushProperty("MessageId", message.Id)) { Log.Information("The MessageId property will be attached to this event"); } The scope of the context is the current logical thread, using AsyncLocal (and so is preserved across async/await calls). Push a property onto the context, returning an that must later be used to remove the property, along with any others that may have been pushed on top of it and not yet popped. The property must be popped from the same thread/logical call context. The name of the property. The value of the property. A handle to later remove the property from the context. If , and the value is a non-primitive, non-array type, then the value will be converted to a structure; otherwise, unknown types will be converted to scalars, which are generally stored as strings. A token that must be disposed, in order, to pop properties back off the stack. Push an enricher onto the context, returning an that must later be used to remove the property, along with any others that may have been pushed on top of it and not yet popped. The property must be popped from the same thread/logical call context. An enricher to push onto the log context A token that must be disposed, in order, to pop properties back off the stack. When is null Push multiple enrichers onto the context, returning an that must later be used to remove the property, along with any others that may have been pushed on top of it and not yet popped. The property must be popped from the same thread/logical call context. . Enrichers to push onto the log context A token that must be disposed, in order, to pop properties back off the stack. When is null Obtain an enricher that represents the current contents of the . This can be pushed back onto the context in a different location/thread when required. An enricher that represents the current contents of the . Remove all enrichers from the , returning an that must later be used to restore enrichers that were on the stack before was called. A token that must be disposed, in order, to restore properties back to the stack. Remove all enrichers from for the current async scope. Constants used in the core logging pipeline and associated types. The name of the property included in the emitted log events when ForContext<T>() and overloads are applied. Adds a new property enricher to the log event. Create a new property enricher. The name of the property. The value of the property. If , and the value is a non-primitive, non-array type, then the value will be converted to a structure; otherwise, unknown types will be converted to scalars, which are generally stored as strings. When is null When is empty or only contains whitespace Enrich the log event. The log event to enrich. Factory for creating new properties to add to the event. When is null When is null Determine how, when destructuring, a supplied value is represented as a complex log event property. If supported, destructure the provided value. The value to destructure. Recursively apply policies to destructure additional values. The destructured value, or null. True if the value could be destructured under this policy. Applied during logging to add additional information to log events. Enrich the log event. The log event to enrich. Factory for creating new properties to add to the event. Provides filtering of the log event stream. Returns true if the provided event is enabled. Otherwise, . The event to test. if the event is enabled by this filter. If is returned, the event will not be emitted. Creates log event properties from regular .NET objects, applying policies as required. Construct a with the specified name and value. The name of the property. The value of the property. If , and the value is a non-primitive, non-array type, then the value will be converted to a structure; otherwise, unknown types will be converted to scalars, which are generally stored as strings. Created instance. Supports the policy-driven construction of s given regular .NET objects. Create a given a .NET object and destructuring strategy. The value of the property. If , and the value is a non-primitive, non-array type, then the value will be converted to a structure; otherwise, unknown types will be converted to scalars, which are generally stored as strings. The value. A destination for log events. Emit the provided log event to the sink. The log event to write. Determine how a simple value is carried through the logging pipeline as an immutable . If supported, convert the provided value into an immutable scalar. The value to convert. The converted value, or null. True if the value could be converted under this policy. The core Serilog logging pipeline. A must be disposed to flush any events buffered within it. Most application code should depend on , not this class. Create a logger that enriches log events via the provided enrichers. Enricher that applies in the context. A logger that will enrich log events as specified. Create a logger that enriches log events via the provided enrichers. Enrichers that apply in the context. A logger that will enrich log events as specified. Create a logger that enriches log events with the specified property. The name of the property. Must be non-empty. The property value. If , the value will be serialized as a structured object if possible; if , the object will be recorded as a scalar or simple array. A logger that will enrich log events as specified. Create a logger that marks log events as being from the specified source type. Type generating log messages in the context. A logger that will enrich log events as specified. Create a logger that marks log events as being from the specified source type. Type generating log messages in the context. A logger that will enrich log events as specified. Write a log event with the specified level. The level of the event. Message template describing the event. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Determine if events at the specified level, and higher, will be passed through to the log sinks. Level to check. if the level is enabled; otherwise, . Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Write an event to the log. The event to write. Write a log event with the level. Message template describing the event. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level. Message template describing the event. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level. Message template describing the event. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Uses configured scalar conversion and destructuring rules to bind a set of properties to a message template. Returns false if the template or values are invalid (ILogger methods never throw exceptions). Message template describing an event. Objects positionally formatted into the message template. The internal representation of the template, which may be used to render the as text. Captured properties from the template and . MessageTemplate template; IEnumerable<LogEventProperty> properties>; if (Log.BindMessageTemplate("Hello, {Name}!", new[] { "World" }, out template, out properties) { var propsByName = properties.ToDictionary(p => p.Name, p => p.Value); Console.WriteLine(template.Render(propsByName, null)); // -> "Hello, World!" } Uses configured scalar conversion and destructuring rules to bind a property value to its captured representation. The name of the property. Must be non-empty. The property value. If , the value will be serialized as a structured object if possible; if , the object will be recorded as a scalar or simple array. The resulting property. True if the property could be bound, otherwise false (ILogger methods never throw exceptions). Close and flush the logging pipeline. An instance that efficiently ignores all method calls. Dynamically controls logging level. Create a at the initial minimum level. The initial level to which the switch is set. The event arises when changed. Note that the event is raised under a lock so be careful within event handler to not fall into deadlock. The current minimum level, below which no events should be generated. Event arguments for event. Creates an instance of specifying old and new levels. Old level. New level. Old level. New level. Indicates that the marked method logs data using a message template and (optional) arguments. The name of the parameter which contains the message template should be given in the constructor. [MessageTemplateFormatMethod("messageTemplate")] public void Information(string messageTemplate, params object[] propertyValues) { // Do something } public void Foo() { Information("Hello, {Name}!") // Warning: Non-existing argument in message template. } Initializes a new instance of the class. Name of the message template parameter. Gets the name of the message template parameter. The name of the message template parameter. Forwards log events to another logging pipeline. Copies the events so that mutations performed on the copies do not affect the originals. The properties dictionary is copied, however the values within the dictionary (of type are expected to be immutable. A base class for visitors that rewrite the value with modifications. For example, implementations might remove all structure properties with a certain name, apply size/length limits, or convert scalar properties of one type into scalar properties of another. Visit a value. Operation state. The value to visit. The result of visiting . When is null Visit a value. Operation state. The value to visit. The result of visiting . When is null Visit a value. Operation state. The value to visit. The result of visiting . When is null Visit a value. Operation state. The value to visit. The result of visiting . When is null Visit a value of an unsupported type. Returns the value unchanged. Operation state. The value to visit. The result of visiting . An abstract base class for visitors that walk data in the format. Subclasses, by overriding appropriate methods, may search for, transform, or print the value structures being visited. Stateless, designed to accommodate allocation-free visiting of multiple values by the same visitor instance. The type of a state object passed through the visiting process. The type of the result generated by visiting a node. Visit the root node type. This method delegates to a concrete Visit*Value() method appropriate for the value. Operation state. The value to visit. The result of visiting . When is null Visit a value. Operation state. The value to visit. The result of visiting . Visit a value. Operation state. The value to visit. The result of visiting . Visit a value. Operation state. The value to visit. The result of visiting . Visit a value. Operation state. The value to visit. The result of visiting . Visit a value of an unsupported type. Always throws , when is not overridden. Operation state. The value to visit. The result of visiting . When is null Always May be thrown by log event sinks when a failure occurs. Should not be used in cases where the exception would propagate out to callers. Construct a to communicate a logging failure. A message describing the logging failure. A simple source of information generated by Serilog itself, for example when exceptions are thrown and caught internally. Set the output mechanism for self-log messages. A synchronized to which self-log messages will be written. When is null Set the output mechanism for self-log messages. An action to invoke with self-log messages. // ReSharper disable once MemberCanBePrivate.Global When is null Clear the output mechanism and disable self-log events. // ReSharper disable once MemberCanBePrivate.Global Write a message to the self-log. Standard .NET format string containing the message. First argument, if supplied. Second argument, if supplied. Third argument, if supplied. The name is historical; because this is used from third-party sink packages, removing the "Line" suffix as would seem sensible isn't worth the breakage. A value represented as a mapping from keys to values. Create a with the provided . The key-value mappings represented in the dictionary. When is null The dictionary mapping. Render the value to the output. The output. A format string applied to the value, or null. A format provider to apply to the value, or null to use the default. . When is null A property associated with a . This type is currently internal, while we consider future directions for the logging pipeline, but should end up public in future. No property. The name of the property. The value of the property. Construct a with the specified name and value. The name of the property. The value of the property. When is null When is empty or only contains whitespace When is null Permit deconstruction of the property into a name/value pair. The name of the property. The value of the property. Indicates whether this instance and a specified are equal. The to compare with the current instance. if and this instance represent the same value; otherwise, . Descriptive aliases for . These do not appear as members of the enumeration as duplicated underlying values result in issues when presenting enum values with . The least significant level of event. The most significant level of event. A value that, when used as a "minimum" level, will result in no events being emitted. It is never correct to construct a with this value. A log event. Construct a new . The time at which the event occurred. The level of the event. An exception associated with the event, or null. The message template describing the event. Properties associated with the event, including those presented in . When is null When is null Construct a new . The time at which the event occurred. The level of the event. An exception associated with the event, or null. The message template describing the event. Properties associated with the event, including those presented in . When is null When is null The time at which the event occurred. The level of the event. The message template describing the event. Render the message template to the specified output, given the properties associated with the event. The output. Supplies culture-specific formatting information, or null. Render the message template given the properties associated with the event, and return the result. Supplies culture-specific formatting information, or null. Properties associated with the event, including those presented in . An exception associated with the event, or null. Add a property to the event if not already present, otherwise, update its value. The property to add or update. When is null Add a property to the event if not already present, otherwise, update its value. The property to add or update. When is default Add a property to the event if not already present. The property to add. When is null Add a property to the event if not already present. The property to add. When is default Remove a property from the event, if present. Otherwise no action is performed. The name of the property to remove. Specifies the meaning and relative importance of a log event. Anything and everything you might want to know about a running block of code. Internal system events that aren't necessarily observable from the outside. The lifeblood of operational intelligence - things happen. Service is degraded or endangered. Functionality is unavailable, invariants are broken or data is lost. If you have a pager, it goes off when one of these occurs. A property associated with a . Construct a with the specified name and value. The name of the property. The value of the property. When is null When is empty or only contains whitespace When is null Construct a from an existing instance. The existing property. When is default The name of the property. The value of the property. Test to determine if it is a valid property name. The name to check. if the name is valid; otherwise, . When is null When is empty or only contains whitespace The value associated with a . Divided into scalar, sequence and structure values to direct serialization into various formats. Render the value to the output. The output. A format string applied to the value, or null. A format provider to apply to the value, or null to use the default. . Returns a string that represents the current object. A string that represents the current object. 2 Formats the value of the current instance using the specified format. The value of the current instance in the specified format. The format to use.-or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the implementation. The provider to use to format the value.-or- A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system. 2 Represents a message template passed to a log method. The template can subsequently render the template in textual form given the list of properties. Represents the empty message template. Construct a message template using manually-defined text and property tokens. The text and property tokens defining the template. Construct a message template using manually-defined text and property tokens. The full text of the template; used by Serilog internally to avoid unneeded string concatenation. The text and property tokens defining the template. When is null When is null Similar to , but faster. The raw text describing the template. Render the template as a string. The string representation of the template. The tokens parsed from the template. Convert the message template into a textual message, given the properties matching the tokens in the message template. Properties matching template tokens. Supplies culture-specific formatting information, or null. The message created from the template and properties. If the properties are mismatched with the template, the template will be returned with incomplete substitution. When is null Convert the message template into a textual message, given the properties matching the tokens in the message template. Properties matching template tokens. The message created from the template and properties. If the properties are mismatched with the template, the template will be returned with incomplete substitution. Supplies culture-specific formatting information, or null. When is null When is null A property value corresponding to a simple, scalar type. Scalar value representing . Construct a with the specified value. The value, which may be null. The value, which may be null. Render the value to the output. The output. A format string applied to the value, or null. A format provider to apply to the value, or null to use the default. . When is null When is null Determine if this instance is equal to . The instance to compare with. if the instances are equal; otherwise, . Get a hash code representing the value. The instance's hash code. A value represented as an ordered sequence of values. Empty sequence of values. Create a with the provided . The elements of the sequence. When is null The elements of the sequence. Render the value to the output. The output. A format string applied to the value, or null. A format provider to apply to the value, or null to use the default. . When is null A value represented as a collection of name-value properties. Construct a with the provided properties. Optionally, a piece of metadata describing the "type" of the structure. Can be null. The properties of the structure. When is null A piece of metadata describing the "type" of the structure, or null. The properties of the structure. Not presented as a dictionary because dictionary construction is relatively expensive; it is cheaper to build a dictionary over properties only when the structure is of interest. Render the value to the output. The output. A format string applied to the value, or null. A format provider to apply to the value, or null to use the default. . When is null Predicates applied to log events that can be used Matches events from the specified source type. The source type. A predicate for matching events. Matches events from the specified source type or namespace and nested types or namespaces. A dotted source type or namespace identifier. A function that matches log events emitted by the source. When is null Matches events with the specified property attached, regardless of its value. The name of the property to match. A predicate for matching events. When is null Matches events with the specified property value. The name of the property to match. The property value to match; must be a scalar type. Null is allowed. A predicate for matching events. When is null Matches events with the specified property value. The name of the property to match. A predicate for testing The type of scalar values to match. A predicate for matching events. When is null When is null Implements the {Level} element. can now have a fixed width applied to it, as well as casing rules. Width is set through formats like "u3" (uppercase three chars), "w1" (one lowercase char), or "t4" (title case four chars). A that supports the Serilog message template format. Formatting log events for display has a different set of requirements and expectations from rendering the data within them. To meet this, the formatter overrides some behavior: First, strings are always output as literals (not quoted) unless some other format is applied to them. Second, tokens without matching properties are skipped rather than being written as raw text. Construct a . A message template describing the output messages. Supplies culture-specific formatting information, or null. When is null Format the log event into the output. The event to format. The output. When is null When is null Describes the properties available in standard message template-based output format strings. The message rendered from the log event. The timestamp of the log event. The level of the log event. A new line. The exception associated with the log event. The properties of the log event. Formats log events in a textual representation. Format the log event into the output. The event to format. The output. Formats log events in a simple JSON structure. Instances of this class are safe for concurrent access by multiple threads. New code should prefer formatters from Serilog.Formatting.Compact, or ExpressionTemplate from Serilog.Expressions. Construct a . A string that will be written after each log event is formatted. If null, will be used. If , the message will be rendered and written to the output as a property named RenderedMessage. Supplies culture-specific formatting information, or null. Format the log event into the output. The event to format. The output. When is null When is null Converts Serilog's structured property value format into JSON. Construct a . When serializing structured (object) values, the property name to use for the Serilog field in the resulting JSON. If null, no type tag field will be written. The default is "_typeTag". Format as JSON to . The value to format The output Visit a value. Operation state. The value to visit. The result of visiting . When is null Visit a value. Operation state. The value to visit. The result of visiting . When is null Visit a value. Operation state. The value to visit. The result of visiting . Visit a value. Operation state. The value to visit. The result of visiting . Write a literal as a single JSON value, e.g. as a number or string. Override to support more value types. Don't write arrays/structures through this method - the active destructuring policies have already indicated the value should be scalar at this point. The value to write. The output Write a valid JSON string literal, escaping as necessary. The string value to write. The output. The core Serilog logging API, used for writing log events. var log = new LoggerConfiguration() .WriteTo.Console() .CreateLogger(); var thing = "World"; log.Information("Hello, {Thing}!", thing); The methods on (and its static sibling ) are guaranteed never to throw exceptions. Methods on all other types may. Create a logger that enriches log events via the provided enrichers. Enricher that applies in the context. A logger that will enrich log events as specified. Create a logger that enriches log events via the provided enrichers. Enrichers that apply in the context. A logger that will enrich log events as specified. Create a logger that enriches log events with the specified property. The name of the property. Must be non-empty. The property value. If , the value will be serialized as a structured object if possible; if , the object will be recorded as a scalar or simple array. A logger that will enrich log events as specified. Create a logger that marks log events as being from the specified source type. Type generating log messages in the context. A logger that will enrich log events as specified. Create a logger that marks log events as being from the specified source type. Type generating log messages in the context. A logger that will enrich log events as specified. Write an event to the log. The event to write. Write a log event with the specified level. The level of the event. Message template describing the event. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Determine if events at the specified level will be passed through to the log sinks. Level to check. if the level is enabled; otherwise, . Write a log event with the level. Message template describing the event. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level. Message template describing the event. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level. Message template describing the event. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level and associated exception. Message template describing the event. Objects positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Uses configured scalar conversion and destructuring rules to bind a set of properties to a message template. Returns false if the template or values are invalid (ILogger methods never throw exceptions). Message template describing an event. Objects positionally formatted into the message template. The internal representation of the template, which may be used to render the as text. Captured properties from the template and . MessageTemplate template; IEnumerable<LogEventProperty> properties; if (Log.BindMessageTemplate("Hello, {Name}!", new[] { "World" }, out template, out properties) { var propsByName = properties.ToDictionary(p => p.Name, p => p.Value); Console.WriteLine(template.Render(propsByName, null)); // -> "Hello, World!" } Uses configured scalar conversion and destructuring rules to bind a property value to its captured representation. The name of the property. Must be non-empty. The property value. If , the value will be serialized as a structured object if possible; if , the object will be recorded as a scalar or simple array. The resulting property. True if the property could be bound, otherwise false (ILogger methods never throw exceptions). An optional static entry point for logging that can be easily referenced by different parts of an application. To configure the set the Logger static property to a logger instance. Log.Logger = new LoggerConfiguration() .WithConsoleSink() .CreateLogger(); var thing = "World"; Log.Logger.Information("Hello, {Thing}!", thing); The methods on (and its dynamic sibling ) are guaranteed never to throw exceptions. Methods on all other types may. The globally-shared logger. When is null Resets to the default and disposes the original if possible Create a logger that enriches log events via the provided enrichers. Enricher that applies in the context. A logger that will enrich log events as specified. Create a logger that enriches log events via the provided enrichers. Enrichers that apply in the context. A logger that will enrich log events as specified. Create a logger that enriches log events with the specified property. A logger that will enrich log events as specified. Create a logger that marks log events as being from the specified source type. Type generating log messages in the context. A logger that will enrich log events as specified. Create a logger that marks log events as being from the specified source type. Type generating log messages in the context. A logger that will enrich log events as specified. Write an event to the log. The event to write. Write a log event with the specified level. The level of the event. Message template describing the event. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level. The level of the event. Message template describing the event. Objects positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Write a log event with the specified level and associated exception. The level of the event. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Determine if events at the specified level will be passed through to the log sinks. Level to check. if the level is enabled; otherwise, . Write a log event with the level. Message template describing the event. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level. Message template describing the event. Objects positionally formatted into the message template. Log.Verbose("Staring into space, wondering if we're alone."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Verbose(ex, "Staring into space, wondering where this comet came from."); Write a log event with the level. Message template describing the event. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level. Message template describing the event. Objects positionally formatted into the message template. Log.Debug("Starting up at {StartedAt}.", DateTime.Now); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Debug(ex, "Swallowing a mundane exception."); Write a log event with the level. Message template describing the event. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Objects positionally formatted into the message template. Log.Information("Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Information(ex, "Processed {RecordCount} records in {TimeMS}.", records.Length, sw.ElapsedMilliseconds); Write a log event with the level. Message template describing the event. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Objects positionally formatted into the message template. Log.Warning("Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Warning(ex, "Skipped {SkipCount} records.", skippedRecords.Length); Write a log event with the level. Message template describing the event. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Objects positionally formatted into the message template. Log.Error("Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Error(ex, "Failed {ErrorCount} records.", brokenRecords.Length); Write a log event with the level. Message template describing the event. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level. Message template describing the event. Objects positionally formatted into the message template. Log.Fatal("Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Object positionally formatted into the message template. Object positionally formatted into the message template. Object positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Write a log event with the level and associated exception. Exception related to the event. Message template describing the event. Objects positionally formatted into the message template. Log.Fatal(ex, "Process terminating."); Uses configured scalar conversion and destructuring rules to bind a set of properties to a message template. Returns false if the template or values are invalid (ILogger methods never throw exceptions). Message template describing an event. Objects positionally formatted into the message template. The internal representation of the template, which may be used to render the as text. Captured properties from the template and . MessageTemplate template; IEnumerable<LogEventProperty> properties>; if (Log.BindMessageTemplate("Hello, {Name}!", new[] { "World" }, out template, out properties) { var propsByName = properties.ToDictionary(p => p.Name, p => p.Value); Console.WriteLine(template.Render(propsByName, null)); // -> "Hello, World!" } Uses configured scalar conversion and destructuring rules to bind a property value to its captured representation. The name of the property. Must be non-empty. The property value. If , the value will be serialized as a structured object if possible; if , the object will be recorded as a scalar or simple array. The resulting property. True if the property could be bound, otherwise false (ILogger methods never throw exceptions). Configuration object for creating instances. Construct a . Configures the sinks that log events will be emitted to. Configures sinks for auditing, instead of regular (safe) logging. When auditing is used, exceptions from sinks and any intermediate filters propagate back to the caller. Most callers should use instead. Not all sinks are compatible with transactional auditing requirements (many will use asynchronous batching to improve write throughput and latency). Sinks need to opt-in to auditing support by extending , though the generic method allows any sink class to be adapted for auditing. Configures the minimum level at which events will be passed to sinks. If not specified, only events at the level and above will be passed through. Configuration object allowing method chaining. Configures enrichment of s. Enrichers can add, remove and modify the properties associated with events. Configures global filtering of s. Configures destructuring of message template parameters. Apply external settings to the logger configuration. Create a logger using the configured sinks, enrichers and minimum level. The logger. To free resources held by sinks ahead of program shutdown, the returned logger may be cast to and disposed. When the logger is already created Extends with additional methods. Create a logger that enriches log events when the specified level is enabled. The type of the property value. The logger. The log event level used to determine if log is enriched with property. The name of the property. Must be non-empty. The property value. If , the value will be serialized as a structured object if possible; if , the object will be recorded as a scalar or simple array. A logger that will enrich log events as specified. When is null A structure representing the alignment settings to apply when rendering a property. Initializes a new instance of . The text alignment direction. The width of the text, in characters. The text alignment direction. The width of the text. Defines the direction of the alignment. Text will be left-aligned. Text will be right-aligned. Instructs the logger on how to store information about provided parameters. Convert known types and objects to scalars, arrays to sequences. Convert all types to scalar strings. Prefix name with '$'. Convert known types to scalars, destructure objects and collections into sequences and structures. Prefix name with '@'. Parses message template strings into sequences of text or property tokens. Parse the supplied message template. The message template to parse. A sequence of text or property tokens. Where the template is not syntactically valid, text tokens will be returned. The parser will make a best effort to extract valid property tokens even in the presence of parsing issues. When is null An element parsed from a message template string. The token's length. Render the token to the output. Properties that may be represented by the token. Output for the rendered string. Supplies culture-specific formatting information, or null. A message template token representing a log event property. Construct a . The name of the property. The token as it appears in the message template. The format applied to the property, if any. The alignment applied to the property, if any. The destructuring strategy applied to the property, if any. When is null When is null The token's length. Render the token to the output. Properties that may be represented by the token. Output for the rendered string. Supplies culture-specific formatting information, or null. When is null When is null The property name. Destructuring strategy applied to the property. Format applied to the property. Alignment applied to the property. if the property name is a positional index; otherwise, . Try to get the integer value represented by the property name. The integer value, if present. True if the property is positional, otherwise false. Determines whether the specified is equal to the current . if the specified object is equal to the current object; otherwise, . The object to compare with the current object. 2 Serves as a hash function for a particular type. A hash code for the current . 2 Returns a string that represents the current object. A string that represents the current object. 2 A message template token representing literal text. Construct a . The text of the token. When is null The token's length. Render the token to the output. Properties that may be represented by the token. Output for the rendered string. Supplies culture-specific formatting information, or null. When is null Determines whether the specified is equal to the current . if the specified object is equal to the current object; otherwise, . The object to compare with the current object. 2 Serves as a hash function for a particular type. A hash code for the current . 2 Returns a string that represents the current object. A string that represents the current object. 2 The text of the token. Apply upper or lower casing to when is provided. Returns when no or invalid format provided The provided with formatting applied Writes the provided value to the output, applying direction-based padding when is provided. Class that provides reusable StringWriters to reduce memory allocations Gets already created StringWriter if there is one available or creates a new one. Clear this instance and prepare it for reuse in the future. Contains "fake extension" methods for the Serilog configuration API. By default the settings knows how to find extension methods, but some configuration are actually "regular" method calls and would not be found otherwise. This static class contains internal methods that can be used instead. See also Specifies that null is allowed as an input even if the corresponding type disallows it. Specifies that null is disallowed as an input even if the corresponding type allows it. Applied to a method that will never return under any circumstance. Specifies that the method will not return if the associated Boolean parameter is passed the specified value. Initializes the attribute with the specified parameter value. The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to the associated parameter matches this value. Gets the condition parameter value. Specifies that an output may be null even if the corresponding type disallows it. Specifies that when a method returns , the parameter may be null even if the corresponding type disallows it. Initializes the attribute with the specified return value condition. The return value condition. If the method returns this value, the associated parameter may be null. Gets the return value condition. Specifies that the method or property will ensure that the listed field and property members have not-null values. Initializes the attribute with a field or property member. The field or property member that is promised to be not-null. Initializes the attribute with the list of field and property members. The list of field and property members that are promised to be not-null. Gets field or property member names. Specifies that the method or property will ensure that the listed field and property members have not-null values when returning with the specified return value condition. Initializes the attribute with the specified return value condition and a field or property member. The return value condition. If the method returns this value, the associated parameter will not be null. The field or property member that is promised to be not-null. Initializes the attribute with the specified return value condition and list of field and property members. The return value condition. If the method returns this value, the associated parameter will not be null. The list of field and property members that are promised to be not-null. Gets the return value condition. Gets field or property member names. Specifies that an output will not be null even if the corresponding type allows it. Specifies that an input argument was not null when the call returns. Specifies that the output will be non-null if the named parameter is non-null. Initializes the attribute with the associated parameter name. The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null. Gets the associated parameter name. Specifies that when a method returns , the parameter will not be null even if the corresponding type allows it. Initializes the attribute with the specified return value condition. The return value condition. If the method returns this value, the associated parameter will not be null. Gets the return value condition. Specifies that this constructor sets all required members for the current type, and callers do not need to set any required members themselves. Specifies the syntax used in a string. Initializes the with the identifier of the syntax used. The syntax identifier. Initializes the with the identifier of the syntax used. The syntax identifier. Optional arguments associated with the specific syntax employed. Gets the identifier of the syntax used. Optional arguments associated with the specific syntax employed. The syntax identifier for strings containing composite formats for string formatting. The syntax identifier for strings containing date format specifiers. The syntax identifier for strings containing date and time format specifiers. The syntax identifier for strings containing format specifiers. The syntax identifier for strings containing format specifiers. The syntax identifier for strings containing JavaScript Object Notation (JSON). The syntax identifier for strings containing numeric format specifiers. The syntax identifier for strings containing regular expressions. The syntax identifier for strings containing time format specifiers. The syntax identifier for strings containing format specifiers. The syntax identifier for strings containing URIs. The syntax identifier for strings containing XML. Used to indicate a byref escapes and is not scoped. There are several cases where the C# compiler treats a as implicitly - where the compiler does not allow the to escape the method. For example: for instance methods. parameters that refer to types. parameters. This attribute is used in those instances where the should be allowed to escape. Applying this attribute, in any form, has impact on consumers of the applicable API. It is necessary for API authors to understand the lifetime implications of applying this attribute and how it may impact their users. Indicates that certain members on a specified are accessed dynamically, for example through . This allows tools to understand which members are being accessed during the execution of a program. This attribute is valid on members whose type is or . When this attribute is applied to a location of type , the assumption is that the string represents a fully qualified type name. When this attribute is applied to a class, interface, or struct, the members specified can be accessed dynamically on instances returned from calling on instances of that class, interface, or struct. If the attribute is applied to a method it's treated as a special case and it implies the attribute should be applied to the "this" parameter of the method. As such the attribute should only be used on instance methods of types assignable to System.Type (or string, but no methods will use it there). Initializes a new instance of the class with the specified member types. The types of members dynamically accessed. Gets the which specifies the type of members dynamically accessed. Specifies the types of members that are dynamically accessed. This enumeration has a attribute that allows a bitwise combination of its member values. Specifies no members. Specifies the default, parameterless public constructor. Specifies all public constructors. Specifies all non-public constructors. Specifies all public methods. Specifies all non-public methods. Specifies all public fields. Specifies all non-public fields. Specifies all public nested types. Specifies all non-public nested types. Specifies all public properties. Specifies all non-public properties. Specifies all public events. Specifies all non-public events. Specifies all interfaces implemented by the type. Specifies all members. States a dependency that one member has on another. This can be used to inform tooling of a dependency that is otherwise not evident purely from metadata and IL, for example a member relied on via reflection. Initializes a new instance of the class with the specified signature of a member on the same type as the consumer. The signature of the member depended on. Initializes a new instance of the class with the specified signature of a member on a . The signature of the member depended on. The containing . Initializes a new instance of the class with the specified signature of a member on a type in an assembly. The signature of the member depended on. The full name of the type containing the specified member. The assembly name of the type containing the specified member. Initializes a new instance of the class with the specified types of members on a . The types of members depended on. The containing the specified members. Initializes a new instance of the class with the specified types of members on a type in an assembly. The types of members depended on. The full name of the type containing the specified members. The assembly name of the type containing the specified members. Gets the signature of the member depended on. Either must be a valid string or must not equal , but not both. Gets the which specifies the type of members depended on. Either must be a valid string or must not equal , but not both. Gets the containing the specified member. If neither nor are specified, the type of the consumer is assumed. Gets the full name of the type containing the specified member. If neither nor are specified, the type of the consumer is assumed. Gets the assembly name of the specified type. is only valid when is specified. Gets or sets the condition in which the dependency is applicable, e.g. "DEBUG". Indicates that the specified method requires the ability to generate new code at runtime, for example through . This allows tools to understand which methods are unsafe to call when compiling ahead of time. Initializes a new instance of the class with the specified message. A message that contains information about the usage of dynamic code. Gets a message that contains information about the usage of dynamic code. Gets or sets an optional URL that contains more information about the method, why it requires dynamic code, and what options a consumer has to deal with it. Indicates that the specified method requires dynamic access to code that is not referenced statically, for example through . This allows tools to understand which methods are unsafe to call when removing unreferenced code from an application. Initializes a new instance of the class with the specified message. A message that contains information about the usage of unreferenced code. Gets a message that contains information about the usage of unreferenced code. Gets or sets an optional URL that contains more information about the method, why it requires unreferenced code, and what options a consumer has to deal with it. Suppresses reporting of a specific rule violation, allowing multiple suppressions on a single code artifact. is different than in that it doesn't have a . So it is always preserved in the compiled assembly. Initializes a new instance of the class, specifying the category of the tool and the identifier for an analysis rule. The category for the attribute. The identifier of the analysis rule the attribute applies to. Gets the category identifying the classification of the attribute. The property describes the tool or tool analysis category for which a message suppression attribute applies. Gets the identifier of the analysis tool rule to be suppressed. Concatenated together, the and properties form a unique check identifier. Gets or sets the scope of the code that is relevant for the attribute. The Scope property is an optional argument that specifies the metadata scope for which the attribute is relevant. Gets or sets a fully qualified path that represents the target of the attribute. The property is an optional argument identifying the analysis target of the attribute. An example value is "System.IO.Stream.ctor():System.Void". Because it is fully qualified, it can be long, particularly for targets such as parameters. The analysis tool user interface should be capable of automatically formatting the parameter. Gets or sets an optional argument expanding on exclusion criteria. The property is an optional argument that specifies additional exclusion where the literal metadata target is not sufficiently precise. For example, the cannot be applied within a method, and it may be desirable to suppress a violation against a statement in the method that will give a rule violation, but not against all statements in the method. Gets or sets the justification for suppressing the code analysis message. Types and Methods attributed with StackTraceHidden will be omitted from the stack trace text shown in StackTrace.ToString() and Exception.StackTrace Initializes a new instance of the class. Represent a type can be used to index a collection either from the start or the end. Index is used by the C# compiler to support the new index syntax int[] someArray = new int[5] { 1, 2, 3, 4, 5 } ; int lastElement = someArray[^1]; // lastElement = 5 Construct an Index using a value and indicating if the index is from the start or from the end. The index value. it has to be zero or positive number. Indicating if the index is from the start or from the end. If the Index constructed from the end, index value 1 means pointing at the last element and index value 0 means pointing at beyond last element. Create an Index pointing at first element. Create an Index pointing at beyond last element. Create an Index from the start at the position indicated by the value. The index value from the start. Create an Index from the end at the position indicated by the value. The index value from the end. Returns the index value. Indicates whether the index is from the start or the end. Calculate the offset from the start using the giving collection length. The length of the collection that the Index will be used with. length has to be a positive value For performance reason, we don't validate the input length parameter and the returned offset value against negative values. we don't validate either the returned offset is greater than the input length. It is expected Index will be used with collections which always have non negative length/count. If the returned offset is negative and then used to index a collection will get out of range exception which will be same affect as the validation. Indicates whether the current Index object is equal to another object of the same type. An object to compare with this object Indicates whether the current Index object is equal to another Index object. An object to compare with this object Returns the hash code for this instance. Converts integer number to an Index. Converts the value of the current Index object to its equivalent string representation. Represent a range has start and end indexes. Range is used by the C# compiler to support the range syntax. int[] someArray = new int[5] { 1, 2, 3, 4, 5 }; int[] subArray1 = someArray[0..2]; // { 1, 2 } int[] subArray2 = someArray[1..^0]; // { 2, 3, 4, 5 } Represent the inclusive start index of the Range. Represent the exclusive end index of the Range. Construct a Range object using the start and end indexes. Represent the inclusive start index of the range. Represent the exclusive end index of the range. Indicates whether the current Range object is equal to another object of the same type. An object to compare with this object Indicates whether the current Range object is equal to another Range object. An object to compare with this object Returns the hash code for this instance. Converts the value of the current Range object to its equivalent string representation. Create a Range object starting from start index to the end of the collection. Create a Range object starting from first element in the collection to the end Index. Create a Range object starting from first element to the end. Calculate the start offset and length of range object using a collection length. The length of the collection that the range will be used with. length has to be a positive value. For performance reason, we don't validate the input length parameter against negative values. It is expected Range will be used with collections which always have non negative length/count. We validate the range is inside the length scope though. Indicates the type of the async method builder that should be used by a language compiler to build the attributed async method or to build the attributed type when used as the return type of an async method. Initializes the . The of the associated builder. Gets the of the associated builder. An attribute that allows parameters to receive the expression of other parameters. Initializes a new instance of the class. The condition parameter value. Gets the parameter name the expression is retrieved from. Indicates that compiler support for a particular feature is required for the location where this attribute is applied. Creates a new instance of the type. The name of the feature to indicate. The name of the compiler feature. If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand . The used for the ref structs C# feature. The used for the required members C# feature. Indicates which arguments to a method involving an interpolated string handler should be passed to that handler. Initializes a new instance of the class. The name of the argument that should be passed to the handler. may be used as the name of the receiver in an instance method. Initializes a new instance of the class. The names of the arguments that should be passed to the handler. may be used as the name of the receiver in an instance method. Gets the names of the arguments that should be passed to the handler. may be used as the name of the receiver in an instance method. Indicates the attributed type is to be used as an interpolated string handler. Reserved to be used by the compiler for tracking metadata. This class should not be used by developers in source code. Used to indicate to the compiler that a method should be called in its containing module's initializer. When one or more valid methods with this attribute are found in a compilation, the compiler will emit a module initializer which calls each of the attributed methods. Certain requirements are imposed on any method targeted with this attribute: - The method must be `static`. - The method must be an ordinary member method, as opposed to a property accessor, constructor, local function, etc. - The method must be parameterless. - The method must return `void`. - The method must not be generic or be contained in a generic type. - The method's effective accessibility must be `internal` or `public`. The specification for module initializers in the .NET runtime can be found here: https://github.com/dotnet/runtime/blob/main/docs/design/specs/Ecma-335-Augments.md#module-initializer Specifies that a type has required members or that a member is required. Used to indicate to the compiler that the .locals init flag should not be set in method headers. Disables the built-in runtime managed/unmanaged marshalling subsystem for P/Invokes, Delegate types, and unmanaged function pointer invocations. The built-in marshalling subsystem has some behaviors that cannot be changed due to backward-compatibility requirements. This attribute allows disabling the built-in subsystem and instead uses the following rules for P/Invokes, Delegates, and unmanaged function pointer invocations: - All value types that do not contain reference type fields recursively (unmanaged in C#) are blittable - Value types that recursively have any fields that have [StructLayout(LayoutKind.Auto)] are disallowed from interop. - All reference types are disallowed from usage in interop scenarios. - SetLastError support in P/Invokes is disabled. - varargs support is disabled. - LCIDConversionAttribute support is disabled. Initializes a new instance of the class. Initializes a new instance of the class with the specified message. An optional message associated with this attribute instance. Returns the optional message associated with this attribute instance. Returns the optional URL associated with this attribute instance. Marks APIs that were obsoleted in a given operating system version. Primarily used by OS bindings to indicate APIs that should not be used anymore. Records the operating system (and minimum version) that supports an API. Multiple attributes can be applied to indicate support on multiple operating systems. Callers can apply a or use guards to prevent calls to APIs on unsupported operating systems. A given platform should only be specified once. Annotates a custom guard field, property or method with a supported platform name and optional version. Multiple attributes can be applied to indicate guard for multiple supported platforms. Callers can apply a to a field, property or method and use that field, property or method in a conditional or assert statements in order to safely call platform specific APIs. The type of the field or property should be boolean, the method return type should be boolean in order to be used as platform guard. Records the platform that the project targeted. Marks APIs that were removed in a given operating system version. Primarily used by OS bindings to indicate APIs that are only available in earlier versions. Annotates the custom guard field, property or method with an unsupported platform name and optional version. Multiple attributes can be applied to indicate guard for multiple unsupported platforms. Callers can apply a to a field, property or method and use that field, property or method in a conditional or assert statements as a guard to safely call APIs unsupported on those platforms. The type of the field or property should be boolean, the method return type should be boolean in order to be used as platform guard. An attribute used to indicate a GC transition should be skipped when making an unmanaged function call. Example of a valid use case. The Win32 `GetTickCount()` function is a small performance related function that reads some global memory and returns the value. In this case, the GC transition overhead is significantly more than the memory read. using System; using System.Runtime.InteropServices; class Program { [DllImport("Kernel32")] [SuppressGCTransition] static extern int GetTickCount(); static void Main() { Console.WriteLine($"{GetTickCount()}"); } } This attribute is ignored if applied to a method without the . Forgoing this transition can yield benefits when the cost of the transition is more than the execution time of the unmanaged function. However, avoiding this transition removes some of the guarantees the runtime provides through a normal P/Invoke. When exiting the managed runtime to enter an unmanaged function the GC must transition from Cooperative mode into Preemptive mode. Full details on these modes can be found at https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/clr-code-guide.md#2.1.8. Suppressing the GC transition is an advanced scenario and should not be done without fully understanding potential consequences. One of these consequences is an impact to Mixed-mode debugging (https://docs.microsoft.com/visualstudio/debugger/how-to-debug-in-mixed-mode). During Mixed-mode debugging, it is not possible to step into or set breakpoints in a P/Invoke that has been marked with this attribute. A workaround is to switch to native debugging and set a breakpoint in the native function. In general, usage of this attribute is not recommended if debugging the P/Invoke is important, for example stepping through the native code or diagnosing an exception thrown from the native code. The runtime may load the native library for method marked with this attribute in advance before the method is called for the first time. Usage of this attribute is not recommended for platform neutral libraries with conditional platform specific code. The P/Invoke method that this attribute is applied to must have all of the following properties: * Native function always executes for a trivial amount of time (less than 1 microsecond). * Native function does not perform a blocking syscall (e.g. any type of I/O). * Native function does not call back into the runtime (e.g. Reverse P/Invoke). * Native function does not throw exceptions. * Native function does not manipulate locks or other concurrency primitives. Consequences of invalid uses of this attribute: * GC starvation. * Immediate runtime termination. * Data corruption. Any method marked with can be directly called from native code. The function token can be loaded to a local variable using the address-of operator in C# and passed as a callback to a native method. Methods marked with this attribute have the following restrictions: * Method must be marked "static". * Must not be called from managed code. * Must only have blittable arguments. Optional. If omitted, the runtime will use the default platform calling convention. Supplied types must be from the official "System.Runtime.CompilerServices" namespace and be of the form "CallConvXXX". Optional. If omitted, no named export is emitted during compilation.