mpv-player / mpv-player/mpv

Logging API for C scripts

Open
#16,707 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

meta:feature-request
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Expected behavior of the wanted feature

Similar to the mp.msg module for Lua scripts which allows sending log messages, we should implement a similar API that can be used by C scripts. I have checked client.h but could not find any function definitions that would allow this.

Alternative behavior of the wanted feature

Manually printing log messages to stderr. This not only looks out-of-line, but will also clobber term-osd.

Log File

No response

Sample Files

The API could perhaps look something like this:

typedef enum mpv_log_level {
    MPV_TRACE,
    MPV_DEBUG,
    MPV_VERBOSE,
    MPV_INFO,
    MPV_WARN,
    MPV_ERROR,
    MPV_FATAL
} mpv_log_level;

// Send a string log message
void mpv_msg_log(mpv_log_level level, const char *msg);

// Use format strings (this could also just be `mpv_msg_log`)
void mpv_msg_logf(mpv_log_level level, const char *fmt, ...);

// Perhaps also shorthands for log levels such as `mpv_msg_info`.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the existing Lua mp.msg module with the C scripting API described in client.h. Define the supported log levels and message or format-string behavior, then verify that C-script logging reaches the normal log handling without clobbering term-osd.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.