MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
Loading...
Searching...
No Matches
logging.h File Reference

Go to the source code of this file.

Data Structures

struct  mln_log_handler

Typedefs

typedef enum mln_log_severity mln_log_severity
typedef enum mln_log_severity_flag mln_log_severity_flag
typedef uint32_t mln_log_severity_flags
typedef enum mln_log_event mln_log_event
typedef void(*) mln_log_callback(void *user_data, mln_log_severity severity, mln_log_event event, int64_t code, mln_buffer_view message)
typedef struct mln_log_handler mln_log_handler

Enumerations

enum  mln_log_severity : uint32_t { MLN_LOG_SEVERITY_INFO = 1 , MLN_LOG_SEVERITY_WARNING = 2 , MLN_LOG_SEVERITY_ERROR = 3 }
enum  mln_log_severity_flag : uint32_t {
  MLN_LOG_SEVERITY_FLAG_INFO = 1U << MLN_LOG_SEVERITY_INFO , MLN_LOG_SEVERITY_FLAG_WARNING = 1U << MLN_LOG_SEVERITY_WARNING , MLN_LOG_SEVERITY_FLAG_ERROR = 1U << MLN_LOG_SEVERITY_ERROR , MLN_LOG_SEVERITY_FLAG_DEFAULT ,
  MLN_LOG_SEVERITY_FLAG_ALL
}
enum  mln_log_event : uint32_t {
  MLN_LOG_EVENT_GENERAL = 0 , MLN_LOG_EVENT_SETUP = 1 , MLN_LOG_EVENT_SHADER = 2 , MLN_LOG_EVENT_PARSE_STYLE = 3 ,
  MLN_LOG_EVENT_PARSE_TILE = 4 , MLN_LOG_EVENT_RENDER = 5 , MLN_LOG_EVENT_STYLE = 6 , MLN_LOG_EVENT_DATABASE = 7 ,
  MLN_LOG_EVENT_HTTP_REQUEST = 8 , MLN_LOG_EVENT_SPRITE = 9 , MLN_LOG_EVENT_IMAGE = 10 , MLN_LOG_EVENT_GRAPHICS_BACKEND = 11 ,
  MLN_LOG_EVENT_JNI = 12 , MLN_LOG_EVENT_ANDROID = 13 , MLN_LOG_EVENT_CRASH = 14 , MLN_LOG_EVENT_GLYPH = 15 ,
  MLN_LOG_EVENT_TIMING = 16
}

Functions

mln_status mln_log_set_callback (const mln_log_handler *handler, mln_diagnostic *out_diagnostic)
mln_status mln_log_clear_callback (mln_diagnostic *out_diagnostic)
mln_status mln_log_set_async_severity_mask (mln_log_severity_flags mask, mln_diagnostic *out_diagnostic)

Detailed Description

Log messages from the library.

Typedef Documentation

◆ mln_log_callback

typedef void(*) mln_log_callback(void *user_data, mln_log_severity severity, mln_log_event event, int64_t code, mln_buffer_view message)

Receives a log message.

Threads: Runs on the thread that logged the message, or on a background thread for the severities that mln_log_set_async_severity_mask() selects. The callback can't call the library.

Lifetimes: message stays valid until the callback returns.

◆ mln_log_event

The part of the library that logged a message.

◆ mln_log_handler

typedef struct mln_log_handler mln_log_handler

A log callback, for mln_log_set_callback().

◆ mln_log_severity

The severity of a log message.

◆ mln_log_severity_flag

A log severity, as a bit in a set.

◆ mln_log_severity_flags

typedef uint32_t mln_log_severity_flags

A set of mln_log_severity_flag bits.

Enumeration Type Documentation

◆ mln_log_event

enum mln_log_event : uint32_t

The part of the library that logged a message.

Enumerator
MLN_LOG_EVENT_GENERAL 
MLN_LOG_EVENT_SETUP 
MLN_LOG_EVENT_SHADER 
MLN_LOG_EVENT_PARSE_STYLE 
MLN_LOG_EVENT_PARSE_TILE 
MLN_LOG_EVENT_RENDER 
MLN_LOG_EVENT_STYLE 
MLN_LOG_EVENT_DATABASE 
MLN_LOG_EVENT_HTTP_REQUEST 
MLN_LOG_EVENT_SPRITE 
MLN_LOG_EVENT_IMAGE 
MLN_LOG_EVENT_GRAPHICS_BACKEND 
MLN_LOG_EVENT_JNI 
MLN_LOG_EVENT_ANDROID 
MLN_LOG_EVENT_CRASH 
MLN_LOG_EVENT_GLYPH 
MLN_LOG_EVENT_TIMING 

◆ mln_log_severity

enum mln_log_severity : uint32_t

The severity of a log message.

Enumerator
MLN_LOG_SEVERITY_INFO 
MLN_LOG_SEVERITY_WARNING 
MLN_LOG_SEVERITY_ERROR 

◆ mln_log_severity_flag

enum mln_log_severity_flag : uint32_t

A log severity, as a bit in a set.

Enumerator
MLN_LOG_SEVERITY_FLAG_INFO 
MLN_LOG_SEVERITY_FLAG_WARNING 
MLN_LOG_SEVERITY_FLAG_ERROR 
MLN_LOG_SEVERITY_FLAG_DEFAULT 

The severities logged on a background thread until mln_log_set_async_severity_mask() changes them.

MLN_LOG_SEVERITY_FLAG_ALL 

Function Documentation

◆ mln_log_clear_callback()

mln_status mln_log_clear_callback ( mln_diagnostic * out_diagnostic)

Sends log messages to the platform's log again, instead of a callback.

◆ mln_log_set_async_severity_mask()

mln_status mln_log_set_async_severity_mask ( mln_log_severity_flags mask,
mln_diagnostic * out_diagnostic )

Selects the severities that the library logs on a background thread.

The library logs other severities on the thread that logged them. mask applies to every runtime in the process.

◆ mln_log_set_callback()

mln_status mln_log_set_callback ( const mln_log_handler * handler,
mln_diagnostic * out_diagnostic )

Sends the log messages of every runtime in the process to a callback.

The callback replaces the one set before.