Enhance Log Entry and add unique code for ERROR & WARNING level#1256
Merged
Enhance Log Entry and add unique code for ERROR & WARNING level#1256
Conversation
…add unique identifier for each unique ERROR/WARNING level.
There was a problem hiding this comment.
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));
…ERROR/WARNING level, rephrased log-entry for user-facing errors.
…ERROR/WARNING level, rephrased log-entry for user-facing errors.
Trouffman
commented
May 4, 2025
| 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(); }); |
Collaborator
Author
There was a problem hiding this comment.
I need to check where this is coming from.
Collaborator
Author
There was a problem hiding this comment.
This is coming from an old commit : f3d6229
but flagged as new due to the changes in the lines counts / order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Additional reformatting of the Log entries for consistency & further add unique identifier for each unique ERROR/WARNING level.
Goal
What has been done
Format & consistency rules
To-Do
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