Skip to content

Conversation

@josedonizetti
Copy link
Collaborator

@josedonizetti josedonizetti commented Oct 29, 2025

Changes:

  • New flag format: Changed from --log level:debug to --log level=debug
  • Structured filters: Changed from --log filter:msg=error to --log filter.include.msg=error
  • Level field rename: Changed level: to lvl: in config for consistency
  • Consistent syntax: All log options now use dot notation for hierarchy and equals for values
  • Added constants: Defined all log flag constants for maintainability
  • Updated parsing: Refactored PrepareLogger to handle new structured format
  • Fixed bugs: Resolved issues with multiple filter options not being applied correctly

Examples:

Old flag format (deprecated):

--log level:debug
--log file:/tmp/tracee.log  
--log aggregate:5s
--log filter:msg=error,pkg=core
--log filter-out:lvl=debug

New flag format:

--log level=debug
--log file=/tmp/tracee.log
--log aggregate.enabled=true --log aggregate.flush-interval=5s
--log filters.include.msg=error --log filters.include.pkg=core
--log filters.exclude.lvl=debug

Old config format (deprecated):

log:
  level: debug
  file: /tmp/tracee.log
  filters:
    msg: [foo, bar]
    level: [error]
  filter-out:
    level: [debug]

New config format:

log:
  level: debug
  file: /tmp/tracee.log
  filters:
    include:
      msg:
        - foo
        - bar
      lvl:
        - error
    exclude:
      lvl:
        - debug

Testing: All existing tests updated + comprehensive test coverage for new format.

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 57.30337% with 76 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@0b8ac82). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/cmd/flags/logger.go 53.28% 58 Missing and 13 partials ⚠️
cmd/tracee/cmd/root.go 0.00% 3 Missing ⚠️
cmd/tracee/cmd/analyze.go 66.66% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4999   +/-   ##
=======================================
  Coverage        ?   29.37%           
=======================================
  Files           ?      234           
  Lines           ?    26184           
  Branches        ?        0           
=======================================
  Hits            ?     7691           
  Misses          ?    17954           
  Partials        ?      539           
Flag Coverage Δ
unit 29.37% <57.30%> (?)
Files with missing lines Coverage Δ
cmd/tracee-ebpf/main.go 0.00% <ø> (ø)
pkg/cmd/cobra/config.go 89.25% <100.00%> (ø)
cmd/tracee/cmd/analyze.go 32.52% <66.66%> (ø)
cmd/tracee/cmd/root.go 0.00% <0.00%> (ø)
pkg/cmd/flags/logger.go 55.36% <53.28%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josedonizetti josedonizetti changed the title New log flag Refactor log flag to new structured Oct 30, 2025
@josedonizetti josedonizetti marked this pull request as ready for review October 30, 2025 19:21
@josedonizetti josedonizetti requested a review from geyslan October 30, 2025 19:21
@josedonizetti josedonizetti changed the title Refactor log flag to new structured Refactor log flag to new structure Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants