Turi Create
4.0
log_level_setter.hpp
Go to the documentation of this file.
1
/* Copyright © 2017 Apple Inc. All rights reserved.
2
*
3
* Use of this source code is governed by a BSD-3-clause license that can
4
* be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5
*/
6
/**
7
* @file log_level_setter.hpp
8
*/
9
10
#ifndef TURI_LOG_LEVEL_SETTER_HPP
11
#define TURI_LOG_LEVEL_SETTER_HPP
12
13
#include <
core/logging/logger.hpp
>
14
15
/**
16
* \ingroup turilogger
17
* Class for setting global log level, unsets log level on destruction.
18
*
19
* Create a log_level_setter object to change the loglevel as desired.
20
* Upon destruction of the object, the loglevel will be reset to the
21
* previous logging level.
22
*
23
* auto e = log_level_setter(LOG_NONE); // quiets the logging that follows
24
*/
25
class
log_level_setter
{
26
private
:
27
int
prev_level;
28
public
:
29
30
/**
31
* Set global log level to the provided log level.
32
* \param loglevel desired loglevel. See logger.hpp:97 for a description of
33
* each level.
34
*/
35
log_level_setter
(
int
loglevel);
36
37
/**
38
* Destructor resets global log level to the previous level.
39
*/
40
~log_level_setter
();
41
};
42
43
44
#endif
log_level_setter::~log_level_setter
~log_level_setter()
logger.hpp
log_level_setter::log_level_setter
log_level_setter(int loglevel)
log_level_setter
Definition:
log_level_setter.hpp:25
core
logging
log_level_setter.hpp
Generated by
1.8.13