Skip to content

replace custom debug handling with LoggingExtras#355

Merged
quinnj merged 2 commits intoapache:mainfrom
baumgold:debug
Nov 3, 2022
Merged

replace custom debug handling with LoggingExtras#355
quinnj merged 2 commits intoapache:mainfrom
baumgold:debug

Conversation

@baumgold
Copy link
Copy Markdown
Member

@baumgold baumgold commented Oct 31, 2022

LoggingExtras.jl already handles this functionality.

@nickrobinson251
Copy link
Copy Markdown
Contributor

the standard Julia logging doesn't quite support the same thing as this, as here we have @debug 1 msg and @debug 2 message to set different levels within the "debug" level. But @quinnj did move similar functionality into LoggingExtras.jl (JuliaLogging/LoggingExtras.jl#73), so we could remove this code here and use @debugv from LoggingExtras.jl to achieve the same thing

@quinnj
Copy link
Copy Markdown
Member

quinnj commented Oct 31, 2022

Yes, that was my plan eventually (switch to the debugv macro in LoggingExtras).

@baumgold
Copy link
Copy Markdown
Member Author

Hmm I guess I mistook Julia's "Programmatically defined levels" feature:

https://github.com/JuliaLang/julia/blob/v1.8.2/base/logging.jl#L183
https://github.com/JuliaLang/julia/blob/v1.8.2/test/corelogging.jl#L36-L41

It seems like this ability to log as non-standard levels and filter loggers for non-standard levels should be supported in Julia's Base. I'll read @quinnj's LoggingExtras. Thanks.

@baumgold baumgold changed the title remove custom debug handling replace custom debug handling with LoggingExtras Nov 1, 2022
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #355 (7eaeb74) into main (384c242) will increase coverage by 0.27%.
The diff coverage is 98.93%.

@@            Coverage Diff             @@
##             main     #355      +/-   ##
==========================================
+ Coverage   87.39%   87.67%   +0.27%     
==========================================
  Files          25       25              
  Lines        3126     3115      -11     
==========================================
- Hits         2732     2731       -1     
+ Misses        394      384      -10     
Impacted Files Coverage Δ
src/Arrow.jl 100.00% <ø> (+47.61%) ⬆️
src/table.jl 96.66% <96.55%> (ø)
src/append.jl 89.87% <100.00%> (ø)
src/arraytypes/arraytypes.jl 89.62% <100.00%> (ø)
src/arraytypes/bool.jl 88.70% <100.00%> (ø)
src/arraytypes/compressed.jl 100.00% <100.00%> (ø)
src/arraytypes/dictencoding.jl 75.58% <100.00%> (ø)
src/arraytypes/fixedsizelist.jl 84.53% <100.00%> (ø)
src/arraytypes/map.jl 100.00% <100.00%> (ø)
src/arraytypes/primitive.jl 94.11% <100.00%> (ø)
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Copy Markdown
Member

@quinnj quinnj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM for now. Thanks for the cleanup @baumgold!

The other step I'd like to do here is that at the top level of Arrow.Stream/Arrow.Table/Arrow.write/Arrow.append (i.e. main user entrypoints), to add a keyword argument debug::Int=0 where the user could simply pass debug=2 and then we'd wrap the body of the methods in:

LoggingExtras.withlevel(Debug; verbosity=debug) do
    # method body
end

I feel like that's a super convenient way to quickly turn on/off the debug logs without having to import LoggingExtras yourself or get the withlevel syntax right.

We don't need to do that here if you'd rather not; I can add it later.

@baumgold
Copy link
Copy Markdown
Member Author

baumgold commented Nov 2, 2022

I'm not a big fan of integrating log-level en/disabling logic within the Arrow APIs as it should really be an orthogonal concept. I understand that your proposal make enabling debug logging convenient, but it also seems to add some extra complexity to an already complex codebase. Maybe your proposal is actually very clean and elegant but I don't see how yet. I'll keep thinking about it but for now I think we should add that change in a separate branch/PR.

@quinnj quinnj merged commit 0be54a9 into apache:main Nov 3, 2022
@ericphanson ericphanson mentioned this pull request Nov 16, 2022
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.

4 participants