Skip to content

[refactor]: simplify logging#223

Merged
1a1a11a merged 8 commits intodevelopfrom
1a1a11a/simplify_logging
Jun 22, 2025
Merged

[refactor]: simplify logging#223
1a1a11a merged 8 commits intodevelopfrom
1a1a11a/simplify_logging

Conversation

@1a1a11a
Copy link
Copy Markdown
Owner

@1a1a11a 1a1a11a commented Jun 22, 2025

Removes VVERBOSE and VVVERBOSE, and renames SEVERE to ERROR. Let us use VERBOSE for per-request logging.

@1a1a11a 1a1a11a requested a review from haochengxia as a code owner June 22, 2025 20:06
@1a1a11a 1a1a11a changed the title 1a1a11a/simplify logging [refactor]: simplify logging Jun 22, 2025
@1a1a11a 1a1a11a requested review from Copilot and haochengxia and removed request for haochengxia June 22, 2025 20:06

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@1a1a11a 1a1a11a requested a review from Copilot June 22, 2025 20:18

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@1a1a11a 1a1a11a requested a review from Copilot June 22, 2025 20:25
Copy link
Copy Markdown
Contributor

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 simplifies the logging subsystem by removing the two extra verbose levels (VVVERBOSE, VVERBOSE), renaming SEVERE to ERROR, and consolidating per-request logs under VERBOSE. It also updates CMake defaults to reflect the new levels and trims workflow triggers.

  • Remove VVVERBOSE/VVERBOSE macros and constants, migrate calls to VERBOSE
  • Rename SEVERE_LEVEL to ERROR_LEVEL and update ERROR macro
  • Adjust CMake logic for default LOGLEVEL and streamline GitHub Actions triggers

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
libCacheSim/traceReader/sampling/spatial.c Replaced VVERBOSE with VERBOSE
libCacheSim/traceReader/sampling/SHARD.c Fixed verbose call text and replaced with VERBOSE
libCacheSim/traceReader/reader.c Swapped VVERBOSE to VERBOSE in skip/read logs
libCacheSim/traceReader/generalReader/txt.c Changed VVERBOSE to VERBOSE during line reads
libCacheSim/include/libCacheSim/macro.h Removed extra debug macros, consolidated verbose func
libCacheSim/include/libCacheSim/logging.h Dropped VVVERBOSE/VVERBOSE definitions, updated ERROR
libCacheSim/include/libCacheSim/const.h Deleted VVVERBOSE_LEVEL/VVERBOSE_LEVEL, added ERROR_LEVEL
libCacheSim/cache/eviction/LeCaR.c Updated multiple VVERBOSE calls to VERBOSE
libCacheSim/cache/eviction/LFUDA.c Migrated VVVERBOSE to VERBOSE
libCacheSim/cache/eviction/LFU.c Replaced VVVERBOSE with VERBOSE
libCacheSim/cache/eviction/GLCache/eviction.c Substituted VVERBOSE with VERBOSE
libCacheSim/cache/eviction/GLCache/GLCache.c Changed VVERBOSE to VERBOSE on segment alloc
libCacheSim/cache/cache.c Swapped two VVERBOSE logs for cache hits/misses
libCacheSim/cache/admission/adaptsize/adaptsize.cpp Updated VVERBOSE calls to VERBOSE in reconfigure
CMakeLists.txt Removed old levels, set defaults by build type
.github/workflows/code-quality.yml Simplified triggers to on: [push, pull_request]
Comments suppressed due to low confidence (3)

libCacheSim/include/libCacheSim/const.h:46

  • You removed VVVERBOSE_LEVEL and VVERBOSE_LEVEL constants; ensure no remaining code or tests reference those levels to avoid undefined symbol errors.
#define ERROR_LEVEL 9

libCacheSim/include/libCacheSim/logging.h:63

  • [nitpick] The change from SEVERE_LEVEL to ERROR_LEVEL is correct, but consider adding a deprecation note or alias for backward compatibility if any third-party code still references the old level.
#if LOGLEVEL <= ERROR_LEVEL

libCacheSim/include/libCacheSim/macro.h:162

  • You renamed the find_max macro to FIND_MAX—verify that all call sites and tests were updated accordingly to prevent compilation failures.
#define FIND_MAX(array, n_elem, max_elem_ptr, max_elem_idx_ptr)               \

Comment thread libCacheSim/include/libCacheSim/macro.h
Comment thread CMakeLists.txt
@@ -67,10 +53,14 @@ endif()

Copy link

Copilot AI Jun 22, 2025

Choose a reason for hiding this comment

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

The logic that sets LOGLEVEL based on unset LOG_LEVEL depends on build type, but CMAKE_BUILD_TYPE is set later. To avoid unexpected defaults, move the set(CMAKE_BUILD_TYPE Release) block before log-level conditions.

Suggested change
set(CMAKE_BUILD_TYPE Release)

Copilot uses AI. Check for mistakes.
cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Collaborator

@haochengxia haochengxia left a comment

Choose a reason for hiding this comment

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

We preserve NONE as the default level but remove the corresponding logic (now it seems caught by unknown option branch and same as INFO. Is it the current design?

Fixed. Plz ignore it.

@1a1a11a
Copy link
Copy Markdown
Owner Author

1a1a11a commented Jun 22, 2025

The goal is that if there is no logging and build option, we use release and info. If the user specifies a logging level, we always honor it; otherwise, we use debug if the build is in debug mode and info for all other builds.

@haochengxia
Copy link
Copy Markdown
Collaborator

The goal is that if there is no logging and build option, we use release and info. If the user specifies a logging level, we always honor it; otherwise, we use debug if the build is in debug mode and info for all other builds.

Got it. The current design is clear. One picky issue: should we consider tolower/toupper build type?

@1a1a11a
Copy link
Copy Markdown
Owner Author

1a1a11a commented Jun 22, 2025

The goal is that if there is no logging and build option, we use release and info. If the user specifies a logging level, we always honor it; otherwise, we use debug if the build is in debug mode and info for all other builds.

Got it. The current design is clear. One picky issue: should we consider tolower/toupper build type?

updated

1a1a11a and others added 8 commits June 22, 2025 17:04
Refactor logging levels by removing VVERBOSE and adjusting log level definitions. Update logging calls throughout the codebase to use VERBOSE instead of VVERBOSE for consistency and clarity.
Updated the logic for setting default log levels based on the build type. Removed redundant checks and streamlined the configuration for log levels, ensuring appropriate defaults are set for both Debug and Release builds. This enhances clarity and maintainability of the build configuration.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@1a1a11a 1a1a11a force-pushed the 1a1a11a/simplify_logging branch from 0f03786 to 59c74df Compare June 22, 2025 21:04
@1a1a11a 1a1a11a merged commit 64551b3 into develop Jun 22, 2025
8 checks passed
@1a1a11a 1a1a11a deleted the 1a1a11a/simplify_logging branch June 22, 2025 21:05
@haochengxia haochengxia self-requested a review June 22, 2025 21:05
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Bug: Debug Build Logging Level Issue

Debug builds incorrectly default to INFO logging instead of DEBUG when LOG_LEVEL is "default". This occurs because the CMAKE_BUILD_TYPE_LOWER MATCHES "Debug" condition is case-sensitive, and CMAKE_BUILD_TYPE_LOWER is set to "debug" (lowercase).

CMakeLists.txt#L63-L64

if(LOG_LEVEL_LOWER STREQUAL "default")
if(CMAKE_BUILD_TYPE_LOWER MATCHES "Debug")

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

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.

3 participants