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 event when destructuring complex types. Type to treat as scalar. Configuration object allowing method chaining. Treat objects of the specified type as scalar values, i.e., don't break them down into properties event 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 destructuring objects, transform instances with the provided policy. Policy to apply when destructuring. 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 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 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 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 passed length 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 passed length 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. 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 true, 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. 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. 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. 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. Controls filter configuration. 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 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. 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. The (partial) namespace or type name to set the override for. The switch controlling loggers for matching sources. Configuration object allowing method chaining. Override the minimum level for events from a specific namespace or type name. 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. Allows additional setting sources to drive the logger configuration. Apply external settings to the logger configuration. Configuration object allowing method chaining. 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. 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. Provided for binary compatibility for earlier versions, should be removed in 3.0. Not marked obsolete because warnings would be syntactically annoying to avoid. 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. 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. 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. 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. 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 . Configuration object allowing method chaining. 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. Configuration object allowing method chaining. 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 true, 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. 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. Push enrichers onto the log context. This method is obsolete, please use instead. Enrichers to push onto the log context A token that must be disposed, in order, to pop properties back off the stack. 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. A handle to later remove the property from the context. If true, 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. Enrich the log event. The log event to enrich. Factory for creating new properties to add to the event. 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, false. The event to test. True if the event is enabled by this filter. If false 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 true, 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. 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 true, 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 true, the value will be serialized as a structured object if possible; if false, 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 will be passed through to the log sinks. Level to check. True if the level is enabled; otherwise, false. 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. True if the property could be bound, otherwise false (ILogger The name of the property. Must be non-empty. The property value. If true, the value will be serialized as a structured object if possible; if false, the object will be recorded as a scalar or simple array. The resulting property. 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 current minimum level, below which no events should be generated. 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. [LoggerMethod("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 . 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. 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 . 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. Operation state. The value to visit. The result of visiting . 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. The output mechanism for self-log messages. SelfLog.Out = Console.Error; Set the output mechanism for self-log messages. A synchronized to which self-log messages will be written. Set the output mechanism for self-log messages. An action to invoke with self-log messages. // ReSharper disable once MemberCanBePrivate.Global 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. 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. . 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. 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 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 . 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 . 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. Add a property to the event if not already present, otherwise, update its value. The property to add or update. Add a property to the event if not already present. The property to add. Add a property to the event if not already present. The property to add. 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. Construct a from an existing instance. The existing property. The name of the property. The value of the property. Test to determine if it is a valid property name. The name to check. True if the name is valid; otherwise, false. 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. 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. 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. A property value corresponding to a simple, scalar type. 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. . Determine if this instance is equal to . The instance to compare with. True if the instances are equal; otherwise, false. Get a hash code representing the value. The instance's hash code. A value represented as an ordered sequence of values. Create a with the provided . The elements of the sequence. 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. . 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. The properties of the structure. 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. . 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. Matches events with the specified property attached, regardless of its value. The name of the property to match. A predicate for matching events. 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. 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. 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. Format the log event into the output. The event to format. The output. This method will apply only upper or lower case formatting, not fixed width 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. Create properties from the provided log event. The log event. A dictionary with properties representing the log event. Create properties from the provided log event. The log event. The output template. A dictionary with properties representing 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. Construct a . A string that will be written after each log event is formatted. If null, will be used. If true, the message will be rendered and written to the output as a property named RenderedMessage. Supplies culture-specific formatting information, or null. Construct a . If true, the properties of the event will be written to the output without enclosing braces. Otherwise, if false, each event will be written as a well-formed JSON object. A string that will be written after each log event is formatted. If null, will be used. Ignored if is true. If true, 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. Adds a writer function for a given type. The type of values, which handles. The function, which writes the values. Writes out individual renderings of attached properties Writes out the values of individual renderings of attached properties Writes out the attached properties Writes out the attached properties values Writes out the attached exception (Optionally) writes out the rendered message Writes out the message template for the logevent. Writes out the log level Writes out the log timestamp Writes out a structure property Writes out a sequence property Writes out a dictionary Writes out a json property with the specified value on output writer Allows a subclass to write out objects that have no configured literal writer. The value to be written as a json construct The writer to write on Perform simple JSON string escaping on . A raw string. A JSON-escaped version of . 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 . 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 . 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. Formats log events as a raw dump of the message template and properties. Format the log event into the output. The event to format. 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 true, the value will be serialized as a structured object if possible; if false, 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. True if the level is enabled; otherwise, false. 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. True if the property could be bound, otherwise false (ILogger The name of the property. Must be non-empty. The property value. If true, the value will be serialized as a structured object if possible; if false, the object will be recorded as a scalar or simple array. The resulting property. 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. 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. True if the level is enabled; otherwise, false. 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. True if the property could be bound, otherwise false (ILogger The name of the property. Must be non-empty. The property value. If true, the value will be serialized as a structured object if possible; if false, the object will be recorded as a scalar or simple array. The resulting property. 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. 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 true, the value will be serialized as a structured object if possible; if false, the object will be recorded as a scalar or simple array. A logger that will enrich log events as specified. 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. An element parsed from a message template string. Construct a . The token's start index in the template. The token's start index in the template. 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 destructuring strategy applied to the property, if any. 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. The token's start index in the template. 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. The property name. Destructuring strategy applied to the property. Format applied to the property. Alignment applied to the property. True if the property name is a positional index; otherwise, false. 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 . true if the specified object is equal to the current object; otherwise, false. 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. The token's start index in the template. 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. Determines whether the specified is equal to the current . true if the specified object is equal to the current object; otherwise, false. 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. 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