Skip to content

Add logbuch to Logging_and_monitoring.yml - #159

Merged
straight-shoota merged 1 commit into
shardbox:masterfrom
jochenseeber:master
Oct 21, 2026
Merged

straight-shoota merged 1 commit into
shardbox:masterfrom
jochenseeber:master

Conversation

@jochenseeber

Copy link
Copy Markdown
Contributor

Annotate a method, and logbuch logs each call to it, with the arguments on entry, the result and the duration on exit, or any exception.

Example:

class Calculator
  @[Logged("dividing two numbers")]
  def divide(a : Int32, b : Int32) : Int32
    a // b
  end
end

Calculator.new.divide(10, 2)

logs (if logging is configured):

 TRACE calculator: dividing two numbers -- method: "Calculator#divide", args: {"a" => 10, "b" => 2}
 TRACE calculator: done dividing two numbers -- method: "Calculator#divide", result: 5, duration_ns: 83

Signed-off-by: Jochen Seeber <jochen@seeber.me>
@straight-shoota
straight-shoota merged commit a7919b5 into shardbox:master Oct 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants