Skip to content

Add logger level-prefix toggle and default to plain message output#154

Open
JorgeG94 with Copilot wants to merge 3 commits into
mainfrom
copilot/add-logging-visibility-option
Open

Add logger level-prefix toggle and default to plain message output#154
JorgeG94 with Copilot wants to merge 3 commits into
mainfrom
copilot/add-logging-visibility-option

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

pic_logger always prepended severity labels (INFO:, VERBOSE:, etc.), which made all logs explicitly tagged with level text. This change makes plain message formatting the default and adds an opt-in switch for explicit level-prefixed output.

  • Logger behavior change (default path)

    • Added internal logger state to control whether level prefixes are rendered.
    • Default is now no level prefix for both console and file output.
  • New public API

    • Added logger_type%set_explicit_printing(logical) to control output style at runtime.
    • set_explicit_printing(.true.) enables LEVEL: ... formatting.
    • set_explicit_printing(.false.) (or default behavior) emits plain message format.
  • Formatting pipeline update

    • Updated log-line rendering to branch on explicit-printing mode while preserving module/procedure context formatting.
    • Applied consistently across console and file sinks.
  • Coverage updates

    • Updated logger content assertions for new default output.
    • Added a targeted test for toggling between plain and explicit-prefixed output in the same logger instance.
type(logger_type) :: logger

! Default: no "INFO:"/"VERBOSE:" prefix
call logger%info("startup complete", "solver", "init")

! Opt in to explicit level prefixes
call logger%set_explicit_printing(.true.)
call logger%info("startup complete", "solver", "init")
! -> INFO: solver.init: startup complete

Copilot AI changed the title Add logger explicit-printing toggle with hidden-level default Add logger level-prefix toggle and default to plain message output Jul 23, 2026
Copilot AI requested a review from JorgeG94 July 23, 2026 11:01
@JorgeG94
JorgeG94 marked this pull request as ready for review July 23, 2026 11:09
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.29%. Comparing base (04b4d2e) to head (c0530a6).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #154      +/-   ##
==========================================
- Coverage   96.31%   96.29%   -0.02%     
==========================================
  Files          54       54              
  Lines       11724    11780      +56     
  Branches      923      925       +2     
==========================================
+ Hits        11292    11344      +52     
- Misses        432      436       +4     
Flag Coverage Δ
unittests 96.29% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/lib/core/logger/pic_logger.f90 93.42% <100.00%> (+0.88%) ⬆️
test/test_pic_logger.f90 99.37% <100.00%> (+0.25%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JorgeG94

Copy link
Copy Markdown
Owner

@copilot the new functions need testing

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot the new functions need testing

Added/expanded tests for the new logger API in commit c0530a6.

Coverage now checks set_explicit_printing across all output shapes:

  • plain message
  • module-only message
  • module+procedure message

and validates both default plain mode and explicit INFO:-prefixed mode.

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