docs
Loading...
Searching...
No Matches
CAPI_Logger.h
Go to the documentation of this file.
1///
2/// Copyright (C) 2026 Ultralight, Inc. All rights reserved.
3/// A license is required for commercial use. https://ultralig.ht
4///
5
6///
7/// @file CAPI_Logger.h
8///
9/// User-defined logging interface.
10///
11/// `#include <Ultralight/CAPI/CAPI_Logger.h>`
12///
13/// The library uses this to report failures, warnings, and status messages.
14///
15/// This is intended to be implemented by users and defined before creating the Renderer.
16///
17/// Each message starts with a tag in brackets for the part of the library it came from (eg,
18/// `[net] Failed to load cacert.pem ...`). The library doesn't send messages below the minimum
19/// log level (see ulConfigSetMinLogLevel()).
20///
21/// @note The library invokes your callback from any of its threads, and more than one call can
22/// be in progress at the same time, so your implementation **must** serialize its writes.
23///
24/// @see ulPlatformSetLogger()
25///
26#ifndef ULTRALIGHT_CAPI_LOGGER_H
27#define ULTRALIGHT_CAPI_LOGGER_H
28
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/******************************************************************************
36 * Logger
37 *****************************************************************************/
38
39///
40/// The severity of a log message, from most to least severe.
41///
42/// @see ulConfigSetMinLogLevel()
43///
44typedef enum {
45 ///
46 /// The application can't continue (eg, a failed device or startup, missing ICU data, or a
47 /// required platform interface that wasn't set).
48 ///
50
51 ///
52 /// A failure the library recovers from (eg, a resource that failed to load).
53 ///
55
56 ///
57 /// A problem or diagnostic that isn't a failure (eg, a misused API call).
58 ///
60
61 ///
62 /// Status information.
63 ///
65
66 ///
67 /// Verbose detail (not sent unless you lower the minimum log level to kLogLevel_Debug with
68 /// ulConfigSetMinLogLevel()).
69 ///
72
73///
74/// The callback invoked when the library wants to print a message to the log.
75///
76/// @param log_level The severity level of the log message.
77///
78/// @param message The log message string. Valid only for the duration of this callback.
79///
80typedef void (*ULLoggerLogMessageCallback)(ULLogLevel log_level, ULString message);
81
82///
83/// User-defined logging interface.
84///
85/// You should implement the callback, then pass an instance of this struct containing your
86/// callback to ulPlatformSetLogger(). The library copies the struct. A NULL `log_message` is
87/// allowed (messages are then dropped).
88///
92
93#ifdef __cplusplus
94} // extern "C"
95#endif
96
97#endif // ULTRALIGHT_CAPI_LOGGER_H
ULLogLevel
The severity of a log message, from most to least severe.
Definition CAPI_Logger.h:44
@ kLogLevel_Info
Status information.
Definition CAPI_Logger.h:64
@ kLogLevel_Error
A failure the library recovers from (eg, a resource that failed to load).
Definition CAPI_Logger.h:54
@ kLogLevel_Warning
A problem or diagnostic that isn't a failure (eg, a misused API call).
Definition CAPI_Logger.h:59
@ kLogLevel_Debug
Verbose detail (not sent unless you lower the minimum log level to kLogLevel_Debug with ulConfigSetMi...
Definition CAPI_Logger.h:70
@ kLogLevel_Fatal
The application can't continue (eg, a failed device or startup, missing ICU data, or a required platf...
Definition CAPI_Logger.h:49
void(*) ULLoggerLogMessageCallback(ULLogLevel log_level, ULString message)
The callback invoked when the library wants to print a message to the log.
Definition CAPI_Logger.h:80
Various defines and utility functions for the C API.
struct C_String * ULString
Opaque handle to a String object.
Definition CAPI_Defines.h:96
User-defined logging interface.
Definition CAPI_Logger.h:89
ULLoggerLogMessageCallback log_message
Definition CAPI_Logger.h:90