Repository navigation
Add an example for logging format arguments with an exception - #101
Merged
Merged
Conversation
examples/exception/LogException.dpr catches an exception and logs it with the (AFormat, AArgs, AException) overload added in #97, using the call Daraja makes when a Web Filter fails to stop. The examples README shows the resulting SimpleLogger output. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Shows Log.Warn('TdjWebFilterHolder.Stop:', E) next to the format-args
call, so the README can compare the two outputs: the exception's class
and message appear in both, so E.Message in the message repeats it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/exception/LogException.dpr(+.dproj): catches an exception and logs it with the(AFormat, AArgs, AException)overload from Add format-args-plus-exception overloads to ILogger #97. It uses the call daraja-framework now makes (Use slf4p's format-args-plus-exception overloads daraja-framework#570):Log.Warn('TdjWebFilterHolder.Stop: %s', [E.Message], E);examples/README.md: a table row and a section with the output:Log.Warn('TdjWebFilterHolder.Stop:', E). The README shows both outputs and notes that puttingE.Messageinto the message as well shows it twice.Test plan
dcc32) builds and runs it, with the output shown above.fpc -Mdelphi -Fu../../src/main LogException.dpr) builds and runs it, with the same output.🤖 Generated with Claude Code