log_set_handler

Function log_set_handler 

Source
pub fn log_set_handler(
    handler: extern "C" fn(type_: LogType, text: *const c_char),
)
Expand description

Registers a C callback for wlc logging.

Note that rustwlc::log_set_default_handler() will register a simple callback that will print the type and text to the console.

§Parameters

The handler callback has two parameters:

  • type: The LogType of the message being printed.
  • text: The text to be logged, currently in C form. One may call rustwlc::pointer_to_string to convert it to a Rust String.

§Safety

The callback function (like other callbacks in rustwlc) must be marked as extern as it is called from C code.

In addition, unsafe will be required to convert the text into a Rust String.