docs
Loading...
Searching...
No Matches
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#pragma once
7#include <Ultralight/String.h>
8
9namespace ultralight {
10
11///
12/// The severity of a log message, from most to least severe.
13///
14/// @see DiagnosticsConfig::min_log_level
15///
16enum class LogLevel : uint8_t {
17 ///
18 /// The application can't continue (eg, a failed device or startup, missing ICU data, or a
19 /// required platform interface that wasn't set).
20 ///
22
23 ///
24 /// A failure the library recovers from (eg, a resource that failed to load).
25 ///
27
28 ///
29 /// A problem or diagnostic that isn't a failure (eg, a misused API call).
30 ///
32
33 ///
34 /// Status information.
35 ///
37
38 ///
39 /// Verbose detail (not sent unless you lower DiagnosticsConfig::min_log_level to Debug).
40 ///
42};
43
44///
45/// User-defined logging interface.
46///
47/// The library uses this to report failures, warnings, and status messages.
48///
49/// This is intended to be implemented by users and defined before creating the Renderer.
50///
51/// Each message starts with a tag in brackets for the part of the library it came from (eg,
52/// `[net] Failed to load cacert.pem ...`). The library doesn't send messages below
53/// DiagnosticsConfig::min_log_level.
54///
55/// @note The library calls LogMessage() from any of its threads, and more than one can be inside
56/// it at the same time, so your implementation **must** serialize its writes.
57///
58/// @see Platform::set_logger()
59///
61public:
62 virtual ~Logger();
63
64 ///
65 /// Called when the library wants to display a log message.
66 ///
67 /// @param log_level The severity of the message.
68 ///
69 /// @param message The message text.
70 ///
71 virtual void LogMessage(LogLevel log_level, const String& message) = 0;
72};
73
74} // namespace ultralight
#define UExport
Definition Exports.h:22
User-defined logging interface.
Definition Logger.h:60
virtual void LogMessage(LogLevel log_level, const String &message)=0
Called when the library wants to display a log message.
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:31
Root namespace for every public Ultralight type, function, and enumeration.
LogLevel
The severity of a log message, from most to least severe.
Definition Logger.h:16
@ Fatal
The application can't continue (eg, a failed device or startup, missing ICU data, or a required platf...
Definition Logger.h:21
@ Debug
Verbose detail (not sent unless you lower DiagnosticsConfig::min_log_level to Debug).
Definition Logger.h:41
@ Warning
Warning icon.
Definition Dialogs.h:56
@ Info
Information icon.
Definition Dialogs.h:55
@ Error
Error icon.
Definition Dialogs.h:57