flutter_flutter/fml/log_settings.h
Chris Bracken 08dabe9601
Clean up C++ includes (#21127)
Cleans up header order/grouping for consistency: associated header, C/C++ system/standard library headers, library headers, platform-specific #includes.

Adds <cstring> where strlen, memcpy are being used: there are a bunch of places we use them transitively.

Applies linter-required cleanups. Disables linter on one file due to included RapidJson header. See https://github.com/flutter/flutter/issues/65676

This patch does not cover flutter/shell/platform/darwin. There's a separate, slightly more intensive cleanup for those in progress.
2020-09-11 21:18:35 -07:00

50 lines
1.3 KiB
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_FML_LOG_SETTINGS_H_
#define FLUTTER_FML_LOG_SETTINGS_H_
#include <string>
#include "flutter/fml/log_level.h"
namespace fml {
// Settings which control the behavior of FML logging.
struct LogSettings {
// The minimum logging level.
// Anything at or above this level will be logged (if applicable).
// Anything below this level will be silently ignored.
//
// The log level defaults to 0 (LOG_INFO).
//
// Log messages for FML_VLOG(x) (from flutter/fml/logging.h) are logged
// at level -x, so setting the min log level to negative values enables
// verbose logging.
LogSeverity min_log_level = LOG_INFO;
};
// Gets the active log settings for the current process.
void SetLogSettings(const LogSettings& settings);
// Sets the active log settings for the current process.
LogSettings GetLogSettings();
// Gets the minimum log level for the current process. Never returs a value
// higher than LOG_FATAL.
int GetMinLogLevel();
class ScopedSetLogSettings {
public:
ScopedSetLogSettings(const LogSettings& settings);
~ScopedSetLogSettings();
private:
LogSettings old_settings_;
};
} // namespace fml
#endif // FLUTTER_FML_LOG_SETTINGS_H_