go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxlog.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef elxlog_h
19#define elxlog_h
20
21#include <cstdint> // For uint8_t.
22#include <string>
23#include <sstream>
24
25namespace elastix
26{
31class log
32{
33public:
34 enum class level : std::uint8_t
35 {
36 info,
37 warn,
38 err,
39 off
40 };
41
43 static bool
44 setup(const std::string & log_filename,
45 const bool do_log_to_file,
46 const bool do_log_to_stdout,
47 const level log_level = {});
48
50 class guard
51 {
52 public:
55
57 guard(const std::string & log_filename,
58 const bool do_log_to_file,
59 const bool do_log_to_stdout,
60 const level log_level);
61
64 };
65
67
68 static void
69 info(const std::string & message);
70 static void
71 warn(const std::string & message);
72 static void
73 error(const std::string & message);
75
77
78 static void
79 info(const std::ostream & stream);
80 static void
81 warn(const std::ostream & stream);
82 static void
83 error(const std::ostream & stream);
85
87
88 static void
89 info_to_log_file(const std::string & message);
90
91 static void
92 info_to_log_file(const std::ostream & stream);
94
96
97 static void
98 to_stdout(const std::string & message);
99
100 static void
101 to_stdout(const std::ostream & stream);
103};
104
105} // end namespace elastix
106
107#endif
guard(const std::string &log_filename, const bool do_log_to_file, const bool do_log_to_stdout, const level log_level)
static void to_stdout(const std::string &message)
static void info_to_log_file(const std::string &message)
static void info(const std::string &message)
static void error(const std::string &message)
static bool setup(const std::string &log_filename, const bool do_log_to_file, const bool do_log_to_stdout, const level log_level={})
static void warn(const std::string &message)
static void info_to_log_file(const std::ostream &stream)
static void to_stdout(const std::ostream &stream)
static void info(const std::ostream &stream)
static void error(const std::ostream &stream)
static void warn(const std::ostream &stream)


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo