[all-commits] [llvm/llvm-project] 9c82f8: Introduce a "log level" support for DEBUG_TYPE (#1...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Mon Jul 28 09:11:00 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9c82f87aec12c77444edf04d46af4d8405becc25
      https://github.com/llvm/llvm-project/commit/9c82f87aec12c77444edf04d46af4d8405becc25
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2025-07-28 (Mon, 28 Jul 2025)

  Changed paths:
    M llvm/include/llvm/Support/Debug.h
    M llvm/include/llvm/Support/DebugLog.h
    M llvm/lib/Support/Debug.cpp
    M llvm/unittests/Support/DebugLogTest.cpp
    M mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
    M mlir/test/IR/test-pattern-logging-listener.mlir

  Log Message:
  -----------
  Introduce a "log level" support for DEBUG_TYPE (#150855)

This allows to set an optional integer level for a given debug type. The
string format is `type[:level]`, and the integer is interpreted as such:

- if not provided: all debugging for this debug type is enabled.
- if >0: all debug that is < to the level is enabled.
- if 0: same as for >0 but also does not disable the other debug-types,
it acts as a negative filter.

The LDBG() macro is updated to accept an optional log level to
illustrate the feature. Here is the expected behavior:

LDBG() << "A"; // Identical to LDBG(1) << "A";
LDBG(2) << "B";

With `--debug-only=some_type`: we'll see A and B in the output.  
With `--debug-only=some_type:1`: we'll see A but not B in the output. 
With `--debug-only=some_type:2`: we'll see A and B in the output. (same
with any level above 2)
With `--debug-only=some_type:0`: we'll see neither A nor B in the
output, but we'll see any other logging for other debug types.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list