Alsvinn  0.5.3
The fast FVM simulator with UQ support
log.hpp
Go to the documentation of this file.
1 /* Copyright (c) 2018 ETH Zurich, Kjetil Olsen Lye
2  * This program is free software: you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #pragma once
17 #include <sstream>
18 #include <boost/log/core.hpp>
19 #include <boost/log/trivial.hpp>
20 #include <boost/log/expressions.hpp>
21 #include <boost/log/utility/setup/file.hpp>
22 #include <boost/log/sources/record_ostream.hpp>
23 #include <boost/log/sources/global_logger_storage.hpp>
24 #include <boost/log/utility/setup/file.hpp>
25 #include <boost/log/utility/setup/common_attributes.hpp>
26 #include <boost/log/sources/logger.hpp>
27 
28 #define INFO alsutils::log::severity_level::info
29 #define NOTIFICATION alsutils::log::severity_level::notification
30 #define WARNING alsutils::log::severity_level::warning
31 #define ERROR alsutils::log::severity_level::error
32 #define CRITICAL alsutils::log::severity_level::critical
33 
34 
35 
36 #define ALSVINN_LOG(severity, message) { \
37  std::stringstream ssForLog; \
38  ssForLog << message; \
39  BOOST_LOG_SEV(::alsutils::log::alsvinnLogger::get(), severity) << ssForLog.str(); \
40  }
41 
42 namespace alsutils {
43 namespace log {
44 
51 };
52 
53 
55  boost::log::sources::severity_logger_mt<severity_level>)
56 
57 
58 void inline setLogFile(const std::string& filename) {
59  boost::log::add_file_log(filename, boost::log::keywords::auto_flush = true );
60 }
61 }
62 }
Definition: log.hpp:46
Definition: log.hpp:49
Definition: log.hpp:50
Definition: log.hpp:48
Various utilities for mpi and cuda.
Definition: Factory.hpp:3
Definition: log.hpp:47
severity_level
Definition: log.hpp:45
BOOST_LOG_INLINE_GLOBAL_LOGGER_DEFAULT(alsvinnLogger, boost::log::sources::severity_logger_mt< severity_level >) void inline setLogFile(const std
Definition: log.hpp:54