Skip to main content

ILogContext Interface

The ILogContext interface provides a way to attach additional contextual information to a log entry. This context can include details such as identifiers, positions, or other values that describe the circumstances under which a log entry was created.

See Log Context for more information about how to use ILogContext in your log entries.

Definition​

Namespace: GHost.Core.Logging.Context
Assembly: GHost.Core.dll

public interface ILogContext

Remarks​

The ILogContext interface is an empty interface that serves as a marker for log context objects. You can create your own log context classes by implementing this interface and adding any properties you find helpful for providing additional information about the log entry.

The value that is sent to the log entry is the result of the log context's ToString() method. Overriding this method provides a custom string representation of the log context that includes the relevant information you want to capture in the log entry.

Implementations​

Class NameDescriptionFormatExample
LineLogContextIndicates the line number of a line of a file.Line n"Line 5"
RowLogContextIndicates the row number of a row in a data table or spreadsheet.Row n"Row 3"
ColumnLogContextIndicates the column number of a column in a data table or spreadsheet.Column n"Column 2"
CellLogContextIndicates the row and column numbers of a cell in a data table or CSV file.Rn, Cn"R3, C2"
CellReferenceLogContextIndicates the row and column numbers along with the cell's reference value in a spreadsheet.Cell CR"Cell A1"
TextLogContextContains any text value you want to include in the log context.Text"Example Text"
RetryLogContextIndicates the retry attempt number of a series of retry operations.Retry n"Retry 2"
ItemLogContextThe base class of the above log contexts<item> n

See Also​