TestingLoggingProvider

A convenient logging provider to use in unit tests, which uses a factory that creates Loggers that send messages to a CachingLogHandler for inspection.

Members

Functions

assertHasMessage
void assertHasMessage(bool delegate(LogMessage) dg, string message)

Asserts that this provider has a cached log message that satisfies the given boolean delegate function.

assertHasMessage
void assertHasMessage(string expected, bool caseSensitive)

Asserts that this provider has a cached log message with the given string message.

assertHasMessage
void assertHasMessage(Level level)

Asserts that this provider has a cached log message with the given level.

assertMessageCount
void assertMessageCount(size_t expected)

Asserts that this provider has exactly an expected amount of messages.

assertMessageCount
void assertMessageCount(Level level, size_t expected)

Asserts that this provider has exactly an expected amount of messages at the given logging level.

assertNoMessages
void assertNoMessages()

Asserts that this provider has no cached messages.

assertNoMessages
void assertNoMessages(Level level)

Asserts that this provider has no cached messages at the given logging level.

messageCount
size_t messageCount()

Gets the number of messages that have been logged.

messageCount
size_t messageCount(Level levelFilter)

Gets the number of messages that have been logged at a given level.

messages
LogMessage[] messages()

Convenience method to get the list of log messages that have been logged to this provider since the last time it was reset.

reset
void reset()

Convenience method to clear this provider's cached list of messages.

Variables

factory
TestingLoggerFactory factory;

The logger factory that this provider uses.