Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated behavior of withInfo and withDebug #414

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
* Improved the handling of track log timestamps - these can now be supplied by the client and are no
longer bound to insert time of DB record. Latest Hoist React uses *start* of the tracked activity.

### ⚙️ Technical

* Updated behavior of `withInfo` and `withDebug` log utils to print a "started" message if logging
enabled at `DEBUG` or `TRACE`, respectively. Allows admins to see start messages for more
important `withInfo` logs, without necessarily printing both lines for all `withDebug` calls.

## 23.0.0 - 2024-09-27

### 💥 Breaking Changes (upgrade difficulty: 🟢 LOW)
Expand Down
4 changes: 3 additions & 1 deletion src/main/groovy/io/xh/hoist/log/LogSupport.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ trait LogSupport {
private <T> T loggedDo(Logger log, Level level, Object msgs, Closure<T> c) {
Map meta = getMeta() ?: [:];

if (log.debugEnabled) {
// Log *start* of closure execution if at a fine run-time level. Use debug to get
// start msgs for your 'withInfo' logs, trace for your 'withDebug/withTrace'
if ((log.debugEnabled && level == INFO) || log.traceEnabled) {
meta << [_status: 'started']
logAtLevel(log, level, msgs, meta)
}
Expand Down
Loading