Open sandboxFocus

Interface ILoggingExceptionHandler

Defines the methods that are called when an exception occurs in the logging component.

Namespace: PostSharp.Patterns.Diagnostics
Assembly: PostSharp.Patterns.Diagnostics.dll
Syntax
public interface ILoggingExceptionHandler
Remarks

The logging component catches the exceptions thrown by the logging code, so that a logging failure does not make the application fail, and passes them to the handler assigned to ExceptionHandler. To change this behavior, implement this interface and assign an instance to that property.

The default handler, DefaultLoggingExceptionHandler, writes a message to the Meta role. In case of an internal exception other than InvalidFormattingStringException, it also disables the LoggingBackend that caused it, until IsEnabled is set to true again. When a debugger is attached at initialization, the default handler is ThrowingLoggingExceptionHandler instead.

Methods

Name Description
OnInternalException(LoggingExceptionInfo)

Called when an exception is thrown in logging code.

OnInvalidUserCode(ref CallerInfo, LoggingTypeSource, string, params object[])

Called when a logging component detects a precondition violation that probably stems from user-written code.

See Also