Flutter Engine
log_settings.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "flutter/fml/log_settings.h"
6 
7 #include <fcntl.h>
8 
9 #include <algorithm>
10 #include <cstring>
11 #include <iostream>
12 
13 #include "flutter/fml/build_config.h"
14 #include "flutter/fml/logging.h"
15 
16 #if defined(OS_FUCHSIA)
17 #include <lib/syslog/global.h>
18 #endif
19 
20 namespace fml {
21 namespace state {
22 
23 // Defined in log_settings_state.cc.
25 
26 } // namespace state
27 
28 void SetLogSettings(const LogSettings& settings) {
29  // Validate the new settings as we set them.
31  std::min(LOG_FATAL, settings.min_log_level);
32 #if defined(OS_FUCHSIA)
33  // Syslog should accept all logs, since filtering by severity is done by fml.
34  FX_LOG_SET_SEVERITY(ALL);
35 #endif
36 }
37 
39  return state::g_log_settings;
40 }
41 
43  return std::min(state::g_log_settings.min_log_level, LOG_FATAL);
44 }
45 
47  old_settings_ = GetLogSettings();
48  SetLogSettings(settings);
49 }
50 
52  SetLogSettings(old_settings_);
53 }
54 
55 } // namespace fml
void SetLogSettings(const LogSettings &settings)
Definition: log_settings.cc:28
int GetMinLogLevel()
Definition: log_settings.cc:42
Definition: ascii_trie.cc:9
LogSettings g_log_settings
LogSeverity min_log_level
Definition: log_settings.h:25
LogSettings GetLogSettings()
Definition: log_settings.cc:38
ScopedSetLogSettings(const LogSettings &settings)
Definition: log_settings.cc:46
AtkStateType state
constexpr LogSeverity LOG_FATAL
Definition: log_level.h:16