NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
Logger.hpp File Reference
#include <filesystem>
#include <fstream>
#include <ostream>
#include <sstream>
#include <string>
#include "boost/core/null_deleter.hpp"
#include "boost/log/attributes.hpp"
#include "boost/log/core/core.hpp"
#include "boost/log/expressions.hpp"
#include "boost/log/expressions/formatters/date_time.hpp"
#include "boost/log/sinks/sync_frontend.hpp"
#include "boost/log/sinks/text_ostream_backend.hpp"
#include "boost/log/sources/global_logger_storage.hpp"
#include "boost/log/sources/severity_logger.hpp"
#include "boost/log/support/date_time.hpp"
#include "boost/log/trivial.hpp"
#include "boost/log/utility/manipulators/add_value.hpp"
#include "boost/log/utility/setup/common_attributes.hpp"
#include "boost/make_shared.hpp"
#include "boost/shared_ptr.hpp"

Go to the source code of this file.

Namespaces

namespace  nc
 
namespace  nc::logger
 
namespace  nc::logger::detail
 Register a global logger.
 

Macros

#define BOOST_LOGGER(severity)
 
#define LOG_DEBUG   BOOST_LOGGER(debug)
 
#define LOG_ERROR   BOOST_LOGGER(error)
 
#define LOG_FATAL   BOOST_LOGGER(fatal)
 
#define LOG_INFO   BOOST_LOGGER(info)
 
#define LOG_TRACE   BOOST_LOGGER(trace)
 
#define LOG_WARNING   BOOST_LOGGER(warning)
 

Typedefs

using nc::logger::detail::text_sink = boost::log::sinks::synchronous_sink< boost::log::sinks::text_ostream_backend >
 

Functions

void nc::logger::addOutputFileLog (std::filesystem::path logFileName)
 Function to add the name of the output log file. More...
 
 nc::logger::BOOST_LOG_GLOBAL_LOGGER_INIT (fileLogger, boost::log::sources::severity_logger_mt)
 Global intializer and constructor for the global logger Sets the initial sink to console backend and sets the default severity level. More...
 
boost::log::formatter nc::logger::detail::createOutputFormat ()
 function to define the format of the output More...
 
void nc::logger::setLogLevel (boost::log::trivial::severity_level level)
 Function to set the severity level to report back to console and log file. More...
 

Variables

constexpr boost::log::trivial::severity_level nc::logger::detail::INIT_LOGLEVEL { boost::log::trivial::severity_level::trace }
 
constexpr char nc::logger::detail::OUTPUT_LOG_FILE_EXT [] = "log"
 
boost::shared_ptr< text_sink > nc::logger::detail::sinkConsole {}
 local variables to hold the sink pointers More...
 
boost::shared_ptr< text_sink > nc::logger::detail::sinkFile {}
 

Detailed Description

Author
David Pilger dpilg.nosp@m.er26.nosp@m.@gmai.nosp@m.l.co.nosp@m.m GitHub Repository

License Copyright 2018-2023 David Pilger

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Description Text file loggger

Macro Definition Documentation

◆ BOOST_LOGGER

#define BOOST_LOGGER (   severity)
Value:
BOOST_LOG_SEV(nc::logger::fileLogger::get(), boost::log::trivial::severity) \
<< boost::log::add_value("Filename", std::filesystem::path(__FILE__).filename().stem().string()) \
<< boost::log::add_value("FunctionName", __FUNCTION__) \
<< boost::log::add_value("LineNumber", uint32_t{ __LINE__ })

◆ LOG_DEBUG

#define LOG_DEBUG   BOOST_LOGGER(debug)

◆ LOG_ERROR

#define LOG_ERROR   BOOST_LOGGER(error)

◆ LOG_FATAL

#define LOG_FATAL   BOOST_LOGGER(fatal)

◆ LOG_INFO

#define LOG_INFO   BOOST_LOGGER(info)

◆ LOG_TRACE

#define LOG_TRACE   BOOST_LOGGER(trace)

◆ LOG_WARNING

#define LOG_WARNING   BOOST_LOGGER(warning)