Skip to content

Conversation

@Trouffman
Copy link
Collaborator

Additional reformatting of the Log entries for consistency & further add unique identifier for each unique ERROR/WARNING level.

Goal

  • Easier to search solution for a specific error
  • Less confusion between error log entries
  • Could help to automate basic support / log analysis
  • Numerical value is irrelevant to other similar 3digit error code (like HTTP)

What has been done

  • Further enhance previous Log Entry reformatting
  • All ERROR level message now have a unique identifier : "ERR-XXX"
  • All WARNING level messages now have a unique identifier : WARN-XXX

Format & consistency rules

  • WARN-XXX for LOG_WARNING level entries
  • ERR-XXX for any LOG_ERROR level entries
  • XXX is 3 digit
  • XXX does not relate to any other error code that exists (like HTTP Code)
  • Some XXX ID can be used of left for special (fun) purpose

like 404 when the NDI library is not found) but is discretionary

  • XXX value is unique across any LOG_LEVEL
  • If a downgrade from ERROR to WARNING : the 3 digits stay the same
  • If an upgrade from WARNING to ERROR : the 3 digits stay the same
  • If a downgrade to a non-WARNING/ERROR level, keep the log Entry ID. (INF-)

In some cases this can be move to the end of the log-entry
If not-upgraded within 12months AND more than 1 Major releases AND in need for cleanup : Code can be "retired" but must still be accessible for historical purposes (wiki?).

  • If the Message attached change : the ERROR code stay the same
  • Log Entry are Specific to the error / location in code / Trigger reason / Root cause. Therefore, If the code change, evaluate if this is the same error / log entry or a new one.
  • In case we go through more than 999 Error/warning ID... The project will be VERY successful, just add a digit.

To-Do

  • Add ERROR Code to the WIki for the relevant Issues / troubleshooting steps
  • Only use the code/ID, not the LOG-ENTRY message (easier to maintain)

List of all code in use as of this release

ERROR Code ID

ERR-400 - Failed to start NDI Main Output
ERR-411 - Failed to initialize NDI Main Output
ERR-412 - Failed to create NDI Main Output

ERR-410 - NDI Output cannot start : Unsupported pixel format

ERR-407 - Error creating the NDI Receiver
ERR-408 - Error creating the NDI Frame Sync
ERR-430 - NDI Source uses an unsupported video pixel format

ERR-404 - NDI library not found, DistroAV cannot continue
ERR-401 - NDI library failed to load
ERR-403 - OBS-NDI is detected and needs to be uninstalled before DistroAV can work
ERR-406 - NDI library could not initialize due to unsupported CPU
ERR-405 - Error loading the NDI Library from path
ERR-402 - Error loading QLibrary with error

ERR-409 - Check for update failed: Cannot get the main OBS window

Warning Code ID

WARN-413 - NDI Output could not start. No Audio/Video data available.
WARN-415 - NDI Sender data capture failed
WARN-416 - NDI Sender initialisation failed

WARN-414 - Invalid or unknown behavior detected in config file
WARN-423 - Failed to create NDI Preview Output

Update Error Code that might need rework.
WARN-417 - Update Check received a non-expected response
WARN-418 - Update Check took too long for a response
WARN-419 - Update Check request failed
WARN-421 - Update Check could not open the update file
WARN-422 - Update Check could not verify the update file

@Trouffman Trouffman added this to the 6.1.0 milestone Apr 25, 2025
@Trouffman Trouffman requested review from BitRate27 and Copilot April 25, 2025 14:14
@Trouffman Trouffman self-assigned this Apr 25, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances logging consistency by embedding unique error and warning codes across various modules to aid in the search for and analysis of log entries. Key changes include:

  • Prefixing log messages with specific error/warning codes (e.g. ERR-XXX and WARN-XXX) for ERROR and WARNING levels.
  • Standardizing log message text to use consistent capitalization for “NDI Main Output”.
  • Updating log levels and messages across multiple files (preview output, update, ndi-source, ndi-output, etc.) for better clarity.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/preview-output.cpp Updated log messages with unique warning code (WARN-423) and added a debug log on failure.
src/obs-support/shared-update.cpp Replaced generic warning messages with codes (WARN-421, WARN-422) for update file issues.
src/obs-support/remote-text.cpp Revised log messages with warning (WARN-419) and added a debug log for HTTP request failures.
src/ndi-source.cpp Changed unsupported pixel format log to error (ERR-430) and added a warning (WARN-414) for config issues.
src/ndi-output.cpp Updated log messages with codes (WARN-413, ERR-410, WARN-415, WARN-416) for proper reporting.
src/main-output.cpp Standardized log text for “NDI Main Output” and introduced error codes (ERR-400, ERR-411, ERR-412).
src/forms/update.cpp Updated log messages for update check timeouts and responses with codes (WARN-417, WARN-418).
Comments suppressed due to low confidence (3)

src/preview-output.cpp:241

  • [nitpick] There is a potential duplication in logging: immediately after logging the warning message, a debug message with similar content is issued. Consider consolidating these logs or clearly distinguishing their purposes to reduce redundancy.
obs_log(LOG_WARNING, "WARN-423 - Failed to create NDI Preview Output '%s'", QT_TO_UTF8(output_name));

src/ndi-source.cpp:926

  • [nitpick] A debug log is emitted immediately before a warning log (with WARN-414) for invalid config behavior. Consider either consolidating these logs or using a consistent log level to avoid potential confusion.
obs_log(LOG_DEBUG, "'... ndi_source_update: Invalid or unknown behavior detected :'%s' forced to '%d'", obs_source_name, behavior, PROP_BEHAVIOR_KEEP_ACTIVE);

src/forms/update.cpp:307

  • The log macro used is 'DEBUG', which is inconsistent with the other parts of the code that use 'LOG_DEBUG'. Using a consistent log level macro improves clarity.
obs_log(DEBUG, "onCheckForUpdateNetworkFinish: Error! httpStatusCode=%d, errorData='%s'; ignoring response", httpStatusCode, QT_TO_UTF8(pluginUpdateInfo.errorData));

@Trouffman Trouffman requested review from RayneYoruka and paulpv May 4, 2025 17:18
QObject::connect(timer, &QTimer::timeout, []() {
obs_log(LOG_WARNING, "updateCheckStart: timer: Request timed out");
obs_log(LOG_WARNING, "WARN-418 - Update Check took too long for a response");
PostToMainThread("timer->timeout", []() { updateCheckStop(); });
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I need to check where this is coming from.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is coming from an old commit : f3d6229

but flagged as new due to the changes in the lines counts / order

@Trouffman Trouffman changed the title Further enhance Log Entry and add unique code for ERROR & WARNING Enhance Log Entry and add unique code for ERROR & WARNING level May 4, 2025
@Trouffman Trouffman merged commit 31f2caf into master May 4, 2025
6 checks passed
@Trouffman Trouffman deleted the tweak-logmessages branch May 4, 2025 17:42
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.

2 participants