Skip to content

Fix outputs added via ulog_output_add ignoting build config#158

Open
an-dr wants to merge 5 commits into
mainfrom
bug/ulog_output_add-manual-outputs
Open

Fix outputs added via ulog_output_add ignoting build config#158
an-dr wants to merge 5 commits into
mainfrom
bug/ulog_output_add-manual-outputs

Conversation

@an-dr
Copy link
Copy Markdown
Owner

@an-dr an-dr commented May 10, 2026

No description provided.

@an-dr an-dr force-pushed the bug/ulog_output_add-manual-outputs branch from 9e0cbac to dbc70e5 Compare May 10, 2026 09:47
an-dr and others added 4 commits May 10, 2026 17:47
…ode (issue #157, saphieron)

The old check `#ifndef ULOG_BUILD_DYNAMIC_CONFIG` treated any definition of
the macro — including `#define ULOG_BUILD_DYNAMIC_CONFIG 0` — as "activate
dynamic mode."  When a user placed that line in their ulog_config.h the
dynamic-config block forced every ULOG_HAS_* to 1, silently ignoring their
ULOG_BUILD_SOURCE_LOCATION=0 and ULOG_BUILD_LEVEL_SHORT=1 settings.

Fix: change to `#if !defined(ULOG_BUILD_DYNAMIC_CONFIG) || !(ULOG_BUILD_DYNAMIC_CONFIG)`
so that zero-valued definitions keep static mode active.

Also adds the ULOG_DYNCONFIG_INIT_* helper macros and ULOG_BUILD_DYNAMIC_*
override flags for users who genuinely run dynamic mode and want to control
the initial runtime state without calling the ulog_*_config() API at startup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eplr)

ulog_event_to_cstr() was passing color=false unconditionally to
log_print_event(), so ANSI escape codes never reached custom handlers
even after calling ulog_color_config(true) — or when ULOG_BUILD_COLOR=1
in static mode.

Fix: pass color_config_is_enabled() instead.  In dynamic mode this reads
the runtime colour flag; in static mode it expands to the compile-time
ULOG_HAS_COLOR constant, so both paths are now consistent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add ulog_event_to_cstr_colored() for handlers that always want ANSI output
- Refactor color gating: color_print_start/end are now unconditional;
  output_stdout_handler checks color_config_is_enabled() at call site
- Move event_to_cstr_impl to private section as a shared helper
- Extend DynamicConfigTest with ulog_event_to_cstr_colored coverage
- Replace issue-named test files with test_event_to_cstr + ulog_config_color_level.h
- Bump version 7.0.3 → 7.1.0 (new public API)
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.

Manual outputs added via ulog_output_add ignore build options such as ULOG_BUILD_SOURCE_LOCATION or ULOG_BUILD_LEVEL_SHORT

1 participant