blob: 08e06e22cf32d51dd9d303fc0ae44b17d608cb41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
// Copyright 2020 The Chromium 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 BASE_TEST_SCOPED_LOGGING_SETTINGS_H_
#define BASE_TEST_SCOPED_LOGGING_SETTINGS_H_
#include "base/logging.h"
namespace logging {
// Saves the current logging settings and restores them when destroyed.
// This is used by logging tests to avoid affecting later tests that
// may run afterward, in the same process.
// Note that the log_file setting is not currently saved/restored.
class BASE_EXPORT ScopedLoggingSettings {
public:
ScopedLoggingSettings();
~ScopedLoggingSettings();
ScopedLoggingSettings(const ScopedLoggingSettings&) = delete;
ScopedLoggingSettings& operator=(const ScopedLoggingSettings&) = delete;
#if defined(OS_CHROMEOS)
void SetLogFormat(LogFormat) const;
#endif
private:
bool enable_process_id_;
bool enable_thread_id_;
bool enable_timestamp_;
bool enable_tickcount_;
int min_log_level_;
LogMessageHandlerFunction message_handler_;
#if defined(OS_CHROMEOS)
LogFormat log_format_;
#endif // defined(OS_CHROMEOS)
};
} // namespace logging
#endif // BASE_TEST_SCOPED_LOGGING_SETTINGS_H_
|