Skip to content

Add /api/v0/log API for querying current log levels #10882

@SgtPooki

Description

@SgtPooki

Checklist

  • My issue is specific & actionable.
  • I am not suggesting a protocol enhancement.
  • I have searched on the issue tracker for my issue.

Description

Enhancement Request

Add GET method support to the /api/v0/log/level API endpoint to enable querying current log levels, complementing the existing POST functionality for setting levels.

Current Behavior

The /api/v0/log/level API currently only supports POST requests for setting log levels:

  • POST /api/v0/log/level?arg=subsystem&arg=level - sets subsystem log level
  • POST /api/v0/log/level?arg=all&arg=level - sets global log level

There is no way to query the current log levels.

Proposed Enhancement

Add GET method support with the following behavior:

  1. Get global log level:

    GET /api/v0/log/level
    Response: {"Level": "info"}
    
  2. Get subsystem log level:

    GET /api/v0/log/level?arg=autonat
    Response: {"Level": "debug"}
    
  3. Get all subsystem levels (optional):

    GET /api/v0/log/level?arg=*
    Response: {
      "Global": "info",
      "Subsystems": {
        "autonat": "debug", 
        "dht": "info",
        "libp2p": "warn"
      }
    }
    

We could also update /api/v0/log/ls to provide this information, but that would be a breaking change.

Motivation

This enhancement would enable:

  1. Web UI applications to display current log level state instead of guessing or defaulting to "info"
  2. Debugging tools to inspect current logging configuration
  3. Configuration management scripts to query before making changes
  4. Better user experience in applications like ipfs-webui where users can see and manage log levels

Currently, applications that build log management interfaces have no way to show users what the current settings actually are, leading to poor user experience and potential confusion about the actual logging state.

Implementation Notes

  • Should maintain backward compatibility with existing POST behavior
  • GET requests should not modify state

This would bring the log level API in line with other Kubo APIs that support both GET (query) and POST (modify) operations.

Related ipshipyard/roadmaps#11

Metadata

Metadata

Assignees

Labels

P1High: Likely tackled by core team if no one steps upeffort/daysEstimated to take multiple days, but less than a weekexp/intermediatePrior experience is likely helpfulkind/enhancementA net-new feature or improvement to an existing featurestatus/in-progressIn progress

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions