Loading...
Searching...
No Matches
log.h
// Copyright (C) 2003-2016 Anders Logg and Jim Tilander
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// Modified by Ola Skavhaug 2007, 2009
//
// First added: 2003-03-13
// Last changed: 2016-06-10
#ifndef __LOG_H
#define __LOG_H
#include <string>
#include "LogLevel.h"
namespace dolfin
{
class Variable;
class Parameters;
void info(std::string msg, ...);
void info(const Parameters& parameters, bool verbose=false);
void info(const Variable& variable, bool verbose=false);
void info_stream(std::ostream& out, std::string msg);
void info_underline(std::string msg, ...);
void warning(std::string msg, ...);
void error(std::string msg, ...);
void dolfin_error(std::string location,
std::string task,
std::string reason, ...);
void deprecation(std::string feature,
std::string version_deprecated,
std::string message, ...);
void log(int debug_level, std::string msg, ...);
void begin(std::string msg, ...);
void begin(int debug_level, std::string msg, ...);
void end();
void set_log_active(bool active=true);
void set_log_level(int level);
void set_indentation_level(std::size_t indentation_level);
void set_output_stream(std::ostream& out);
int get_log_level();
void monitor_memory_usage();
void not_working_in_parallel(std::string what);
// Helper function for dolfin_debug macro
void __debug(std::string file,
unsigned long line,
std::string function,
std::string format, ...);
// Helper function for dolfin_dolfin_assert macro
void __dolfin_assert(std::string file,
unsigned long line,
std::string function,
std::string check);
}
// The following three macros are the only "functions" in DOLFIN
// named dolfin_foo. Other functions can be placed inside the
// DOLFIN namespace and therefore don't require a prefix.
// Debug macros (with varying number of arguments)
#define dolfin_debug(msg) do { dolfin::__debug(__FILE__, __LINE__, __FUNCTION__, msg); } while (false)
#define dolfin_debug1(msg, a0) do { dolfin::__debug(__FILE__, __LINE__, __FUNCTION__, msg, a0); } while (false)
#define dolfin_debug2(msg, a0, a1) do { dolfin::__debug(__FILE__, __LINE__, __FUNCTION__, msg, a0, a1); } while (false)
#define dolfin_debug3(msg, a0, a1, a2) do { dolfin::__debug(__FILE__, __LINE__, __FUNCTION__, msg, a0, a1, a2); } while (false)
#define dolfin_debug4(msg, a0, a1, a2, a3) do { dolfin::__debug(__FILE__, __LINE__, __FUNCTION__, msg, a0, a1, a2, a3); } while (false)
// Not implemented error, reporting function name and line number
#define dolfin_not_implemented() \
do { \
dolfin::dolfin_error("log.h", \
"perform call to DOLFIN function", \
"The function %s has not been implemented (in %s line %d)", \
__FUNCTION__, __FILE__, __LINE__); \
} while (false)
// Assertion, only active if DEBUG is defined
#ifdef DEBUG
#define dolfin_assert(check) \
do { \
if (!(check)) \
{ \
dolfin::__dolfin_assert(__FILE__, __LINE__, __FUNCTION__, #check); \
} \
} while (false)
#else
#define dolfin_assert(check)
#endif
#endif
dolfin::Parameters
Definition Parameters.h:95
dolfin::Variable
Common base class for DOLFIN variables.
Definition Variable.h:36
dolfin
Definition adapt.h:30
dolfin::not_working_in_parallel
void not_working_in_parallel(std::string what)
Definition log.cpp:205
dolfin::info_stream
void info_stream(std::ostream &out, std::string msg)
Print message to stream.
Definition log.cpp:97
dolfin::info_underline
void info_underline(std::string msg,...)
Print underlined message.
Definition log.cpp:107
dolfin::warning
void warning(std::string msg,...)
Print warning.
Definition log.cpp:115
dolfin::set_log_level
void set_log_level(int level)
Set log level.
Definition log.cpp:180
dolfin::begin
void begin(std::string msg,...)
Begin task (increase indentation level).
Definition log.cpp:153
dolfin::set_log_active
void set_log_active(bool active=true)
Turn logging on or off.
Definition log.cpp:175
dolfin::dolfin_error
void dolfin_error(std::string location, std::string task, std::string reason,...)
Definition log.cpp:129
dolfin::error
void error(std::string msg,...)
Definition log.cpp:123
dolfin::get_log_level
int get_log_level()
Get log level.
Definition log.cpp:195
dolfin::set_indentation_level
void set_indentation_level(std::size_t indentation_level)
Set indentation level.
Definition log.cpp:185
dolfin::end
void end()
End task (decrease indentation level).
Definition log.cpp:168
dolfin::set_output_stream
void set_output_stream(std::ostream &out)
Set output stream.
Definition log.cpp:190
dolfin::monitor_memory_usage
void monitor_memory_usage()
Definition log.cpp:200
dolfin::parameters
GlobalParameters parameters
The global parameter database.
Definition GlobalParameters.cpp:32
dolfin::deprecation
void deprecation(std::string feature, std::string version_deprecated, std::string message,...)
Definition log.cpp:137
dolfin::log
void log(int debug_level, std::string msg,...)
Print message at given debug level.
Definition log.cpp:145
dolfin::info
void info(std::string msg,...)
Print message.
Definition log.cpp:72