Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
fml::LogInterestListener Class Reference

#include <log_interest_listener.h>

Public Member Functions

 LogInterestListener (fidl::ClientEnd<::fuchsia_logger::LogSink > client_end, async_dispatcher_t *dispatcher)
 
void AsyncWaitForInterestChanged ()
 

Static Public Member Functions

static void HandleInterestChange (const fuchsia_diagnostics::Interest &interest)
 

Detailed Description

Definition at line 18 of file log_interest_listener.h.

Constructor & Destructor Documentation

◆ LogInterestListener()

fml::LogInterestListener::LogInterestListener ( fidl::ClientEnd<::fuchsia_logger::LogSink >  client_end,
async_dispatcher_t *  dispatcher 
)
inline

Definition at line 20 of file log_interest_listener.h.

22 : log_sink_(std::move(client_end), dispatcher) {}

Member Function Documentation

◆ AsyncWaitForInterestChanged()

void fml::LogInterestListener::AsyncWaitForInterestChanged ( )

Definition at line 16 of file log_interest_listener.cc.

16 {
17 log_sink_->WaitForInterestChange().Then(
18 [this](fidl::Result<fuchsia_logger::LogSink::WaitForInterestChange>&
19 interest_result) {
20 if (interest_result.is_error()) {
21 // Gracefully terminate on loop shutdown
22 auto error = interest_result.error_value();
23 ZX_ASSERT_MSG(error.is_framework_error() &&
24 error.framework_error().is_dispatcher_shutdown(),
25 "%s", error.FormatDescription().c_str());
26 return;
27 }
28 HandleInterestChange(interest_result->data());
30 });
31}
static void HandleInterestChange(const fuchsia_diagnostics::Interest &interest)

◆ HandleInterestChange()

void fml::LogInterestListener::HandleInterestChange ( const fuchsia_diagnostics::Interest &  interest)
static

Definition at line 33 of file log_interest_listener.cc.

34 {
35 auto severity =
36 interest.min_severity().value_or(fuchsia_diagnostics::Severity::kInfo);
37 if (severity <= fuchsia_diagnostics::Severity::kDebug) {
38 fml::SetLogSettings({.min_log_level = -1}); // Verbose
39 } else if (severity <= fuchsia_diagnostics::Severity::kInfo) {
40 fml::SetLogSettings({.min_log_level = kLogInfo});
41 } else if (severity <= fuchsia_diagnostics::Severity::kWarn) {
42 fml::SetLogSettings({.min_log_level = kLogWarning});
43 } else if (severity <= fuchsia_diagnostics::Severity::kError) {
44 fml::SetLogSettings({.min_log_level = kLogError});
45 } else {
46 fml::SetLogSettings({.min_log_level = kLogFatal});
47 }
48}
constexpr LogSeverity kLogFatal
Definition log_level.h:19
void SetLogSettings(const LogSettings &settings)
constexpr LogSeverity kLogError
Definition log_level.h:15
constexpr LogSeverity kLogInfo
Definition log_level.h:13
constexpr LogSeverity kLogWarning
Definition log_level.h:14

The documentation for this class was generated from the following files: