annotation Logbuch::Annotations::LogError

Overview

Sets how a traced method logs the exceptions of the listed types and their subclasses: @[LogError(IO::Error, KeyError, :warn, stacktrace: false)] writes their error lines at :warn (:error by default) without the stack trace (by default, the exception type's @[LogType(stacktrace:)] decides). The level can also be a Log::Severity member, as in @[LogError(IO::Error, Log::Severity::Warn)]. Without types, it applies to every exception the method's other LogError annotations do not list. A method can carry several; the most specific type wins. On a method without @[Logged], it traces the method, as a @[Logged] without arguments does.

Defined in:

logbuch/annotations.cr