Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(logging): add logging namespace and create logging::init method #2336

Conversation

ReenigneArcher
Copy link
Member

@ReenigneArcher ReenigneArcher commented Mar 31, 2024

Description

Boost logs are captured in unit tests, and it was discovered that some encoder logging messages were not captured. This PR moves more (and hopefully all) logging setup to a logging::init method.

Example test output prior to this PR:

[ RUN      ] EncoderVariants/EncoderTest.ValidateEncoder/2
[libx264 @ 0x55d3f87659c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55d3f87659c0] profile High, level 4.2, 4:2:0, 8-bit
[libx264 @ 0x55d3f87659c0] frame I:1     Avg QP:31.00  size:  1203
[libx264 @ 0x55d3f87659c0] mb I  I16..4: 99.9%  0.0%  0.0%
[libx264 @ 0x55d3f87659c0] 8x8 transform intra:0.0%
[libx264 @ 0x55d3f87659c0] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0%
[libx264 @ 0x55d3f87659c0] i16 v,h,dc,p: 97%  0%  3%  0%
[libx264 @ 0x55d3f87659c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 75% 12%  0%  0%  0%  0% 12%
[libx264 @ 0x55d3f87659c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  0% 100%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x55d3f87659c0] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0x55d3f87659c0] kb/s:577.44
[       OK ] EncoderVariants/EncoderTest.ValidateEncoder/2 (69 ms)

Todo:

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

Copy link

codecov bot commented Mar 31, 2024

Codecov Report

Attention: Patch coverage is 72.89720% with 29 lines in your changes are missing coverage. Please review.

Project coverage is 6.50%. Comparing base (a1edc24) to head (b19a026).

Additional details and impacted files
@@            Coverage Diff             @@
##           nightly   #2336      +/-   ##
==========================================
+ Coverage     6.10%   6.50%   +0.39%     
==========================================
  Files           85      85              
  Lines        18303   18382      +79     
  Branches      8319    8348      +29     
==========================================
+ Hits          1118    1196      +78     
+ Misses       16151   15360     -791     
- Partials      1034    1826     +792     
Flag Coverage Δ
Linux 4.42% <50.76%> (+0.30%) ⬆️
Windows 2.00% <60.00%> (+0.48%) ⬆️
macOS-12 8.73% <64.21%> (+0.61%) ⬆️
macOS-13 8.07% <65.30%> (?)
macOS-14 8.39% <69.38%> (+0.66%) ⬆️

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

Files Coverage Δ
src/entry_handler.cpp 4.82% <0.00%> (+0.03%) ⬆️
src/stream.cpp 1.13% <0.00%> (ø)
src/config.cpp 5.35% <0.00%> (ø)
src/logging.cpp 77.77% <76.47%> (+56.34%) ⬆️

... and 26 files with indirect coverage changes

@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch 3 times, most recently from 7b2b47b to 1e2d83d Compare March 31, 2024 12:54
@ReenigneArcher

This comment was marked as resolved.

@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch 2 times, most recently from 57847c6 to 0e7bd21 Compare March 31, 2024 14:13
src/logging.cpp Outdated Show resolved Hide resolved

// Flush after each log record to ensure log file contents on disk isn't stale.
// This is particularly important when running from a Windows service.
sink->locked_backend()->auto_flush(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is enabled, why are we even flushing manually?

Copy link
Member Author

@ReenigneArcher ReenigneArcher Apr 1, 2024

Choose a reason for hiding this comment

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

I'm not sure, perhaps the manual flush was just left over from before auto_flush was added? Maybe @cgutman has some idea?

@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch 6 times, most recently from 0e083ed to d9794e2 Compare April 1, 2024 02:16
@ReenigneArcher ReenigneArcher marked this pull request as ready for review April 1, 2024 02:37
@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch from d9794e2 to 6e09df4 Compare April 1, 2024 02:43
@ReenigneArcher ReenigneArcher marked this pull request as draft April 1, 2024 02:48
@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch 2 times, most recently from 77e7eb0 to e88ee8b Compare April 1, 2024 18:31
@ReenigneArcher ReenigneArcher marked this pull request as ready for review April 1, 2024 19:13
@ReenigneArcher ReenigneArcher requested a review from cgutman April 1, 2024 19:13
src/logging.cpp Outdated Show resolved Hide resolved
src/logging.cpp Show resolved Hide resolved
src/logging.cpp Show resolved Hide resolved
src/logging.cpp Outdated Show resolved Hide resolved
tests/conftest.cpp Outdated Show resolved Hide resolved
tests/unit/test_logging.cpp Outdated Show resolved Hide resolved
@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch 2 times, most recently from d71a354 to cfdef36 Compare April 1, 2024 21:07
src/logging.h Outdated Show resolved Hide resolved
src/logging.cpp Outdated Show resolved Hide resolved
@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch from cfdef36 to cfbf529 Compare April 1, 2024 21:28
@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch 2 times, most recently from a31cf23 to ac751ad Compare April 1, 2024 21:43
src/logging.h Outdated Show resolved Hide resolved
@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch from ac751ad to 51b6b20 Compare April 1, 2024 23:11
@ReenigneArcher ReenigneArcher force-pushed the fix(logging)-add-logging-namespace-and-create-logging-init-method branch from 51b6b20 to b19a026 Compare April 3, 2024 00:05
@ReenigneArcher ReenigneArcher merged commit 2da6fb0 into nightly Apr 3, 2024
51 checks passed
@ReenigneArcher ReenigneArcher deleted the fix(logging)-add-logging-namespace-and-create-logging-init-method branch April 3, 2024 00:57
KuleRucket pushed a commit to KuleRucket/Sunshine that referenced this pull request Jun 6, 2024
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