Skip to main content

Error Method

Writes an error-level log entry.

Definition​

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

Overloads​

NameDescription
Error(string)Writes an error log entry.
Error(Exception)Writes an error log entry for an exception.
Error(ILogContext, Exception)Writes an error log entry for an exception with context.
Error(string, Exception)Writes an error log entry with a log code and exception.
Error(string, string, object[])Writes a formatted error log entry with a log code.
Error(string, Exception, string, object[])Writes a formatted error log entry with a log code and exception.
Error(string, ILogContext, Exception)Writes an error log entry with a log code, context, and exception.
Error(string, ILogContext, string, object[])Writes a formatted error log entry with a log code and context.
Error(string, ILogContext, Exception, string, object[])Writes a formatted error log entry with a log code, context, and exception.

Remarks​

The overloads of this method that include a code parameter allow you to specify a unique code (mnemonic or otherwise) that identifies the log message. See the Log Codes page for more information on log codes and how to use them effectively.


Error(string message)​

Writes an error log entry with the specified message.

void Error(string message);

Parameters​

message string
The log message.


Error(Exception ex)​

Writes an error log entry for the specified exception.

void Error(Exception ex);

Parameters​

ex Exception
The exception to log.


Error(ILogContext context, Exception ex)​

Writes an error log entry for the specified exception and context.

void Error(ILogContext context, Exception ex);

Parameters​

context ILogContext
An instance to provide an additional log context to the log entry.

ex Exception
The exception to log.


Error(string code, Exception ex)​

Writes an error log entry with a log code and exception.

void Error(string code, Exception ex);

Parameters​

code string
A unique code (mnemonic or otherwise) that identifies the log message.

ex Exception
The exception to log.


Error(string code, string message, params object[] args)​

Writes a formatted error log entry with a log code.

void Error(string code, string message, params object[] args);

Parameters​

code string
A unique code (mnemonic or otherwise) that identifies the log message.

message string
A string containing the message and format items to log.

args object[]
A params array of objects that match the format items in the message to provide them with values.


Error(string code, Exception ex, string message, params object[] args)​

Writes a formatted error log entry with a log code and exception.

void Error(string code, Exception ex, string message, params object[] args);

Parameters​

code string
A unique code (mnemonic or otherwise) that identifies the log message.

ex Exception
The exception to log.

message string
A string containing the message and format items to log.

args object[]
A params array of objects that match the format items in the message to provide them with values.


Error(string code, ILogContext context, Exception ex)​

Writes an error log entry with a log code, context, and exception.

void Error(string code, ILogContext context, Exception ex);

Parameters​

code string
A unique code (mnemonic or otherwise) that identifies the log message.

context ILogContext
An instance to provide an additional log context to the log entry.

ex Exception
The exception to log.


Error(string code, ILogContext context, string message, params object[] args)​

Writes a formatted error log entry with a log code and context.

void Error(string code, ILogContext context, string message, params object[] args);

Parameters​

code string
A unique code (mnemonic or otherwise) that identifies the log message.

context ILogContext
An instance to provide an additional log context to the log entry.

message string
A string containing the message and format items to log.

args object[]
A params array of objects that match the format items in the message to provide them with values.


Error(string code, ILogContext context, Exception ex, string message, params object[] args)​

Writes a formatted error log entry with a log code, context, and exception.

void Error(string code, ILogContext context, Exception ex, string message, params object[] args);

Parameters​

code string
A unique code (mnemonic or otherwise) that identifies the log message.

context ILogContext
An instance to provide an additional log context to the log entry.

ex Exception
The exception to log.

message string
A string containing the message and format items to log.

args object[]
A params array of objects that match the format items in the message to provide them with values.