Skip to content

Instance Method

logging(to:)

Return a new SQLDatabase which is indistinguishable from the original save that its logger property is replaced by the given Logger.
func logging(to logger: Logger) -> any SQLDatabase

Parameters

logger

The new Logger to use.

Return Value

A database object which logs to the new Logger.

Discussion

This has the effect of redirecting logging performed on or by the original database to the provided Logger.

Warning

The log redirection applies only to the new SQLDatabase that is returned from this method; logging operations performed on the original (i.e. self) are unaffected.

Note

Because this method returns a generic SQLDatabase, the type it returns need not be public API. Unfortunately, this also means that no inlining or static dispatch of the implementation is possible, thus imposing a performance penalty on the use of this otherwise trivial utility.