Errors and Logging
By default, libOmexMeta
and its dependencies librdf
, raptor
and sparql
log information, errors and warnings to console. In the following, an error is produced
because the rdfxml
string is being treated as turtle
syntax.
# Information, warnings and errors are logged to console by default
from pyomexmeta import RDF, Logger, Message
cellml = '''<?xml version=\"1.1\" encoding=\"UTF-8\"?>
<model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">
<component name=\"main\">
<variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />
<variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />
<variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />
</component>
</model>'''
# oops - did a whoops. Parsing rdfxml as turtle
rdf = RDF.from_string(cellml, syntax="turtle") # See Python console for logging message
assert len(Logger()) == 1
# get the message as a object
message = Logger()[0]
# print as string
print(message)
# or collect the message content / level as objects
message_string = message.get_message()
message_level = message.get_level()
print("message_string: ", message_string)
print("message_level: ", message_level)
# now clear the logger
Logger.clear()
assert len(Logger()) == 0
[16:33:35 +01:00] error : syntax error at '<'
error: syntax error at '<'
message_string: syntax error at '<'
message_level: error
// Information, warnings and errors are logged to console by default
#include "omexmeta/OmexMeta.h"
using namespace omexmeta;
int main(){
std::string cellml = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"
" <model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">\n"
" <component name=\"main\">\n"
" <variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />\n"
" </component>\n"
" </model>";
// oops - did a whoops. Parsing rdfxml as turtle
RDF rdf1 = RDF::fromString(cellml, "turtle"); // See console
assert(Logger::getLogger()->size() == 1);
// get the message
Message message = (*Logger::getLogger())[0];
// output message content to stdout
std::cout << message << std::endl;
// collect message content / level
std::string messageString = message.getMessage();
LogLevel messageLevel = message.getLevel();
std::cout << "messageString: " << messageString << std::endl;
std::cout << "messageLevel: " << messageLevel << std::endl;
// now clear the logger
Logger::getLogger()->clear();
assert(Logger::getLogger()->size() == 0);
return 0;
}
[16:33:49 +01:00] error : syntax error at '<'
4: syntax error at '<'
messageString: syntax error at '<'
messageLevel: 4
// Information, warnings and errors are logged to console by default
#include "omexmeta/OmexMetaCApi.h"
using namespace omexmeta;
int main() {
const char *cellml = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"
" <model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">\n"
" <component name=\"main\">\n"
" <variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />\n"
" </component>\n"
" </model>";
// oops - did a whoops. Parsing rdfxml as turtle
RDF *rdf = RDF_fromString(cellml, "turtle");// See console
// get the logger
Logger *logger = Logger_getLogger();
assert(Logger_size() == 1);
// get the message
Message *message = Logger_getMessageI(0);
// collect message content / level
char *messageString = Message_getMessage(message);// remember to free returned char*
// output message content to stdout
printf("%s\n", messageString);
// get the message level
int messageLevel = Message_getLevel(message);
printf("messageString: %s\n", messageString);
printf("messageLevel: %i\n", messageLevel);
// now clear the logger
Logger_clear();
assert(Logger_size() == 0);
Message_deleteMessage(message);
free(messageString);
return 0;
}
[16:33:49 +01:00] error : syntax error at '<'
syntax error at '<'
messageString: syntax error at '<'
messageLevel: 4
Logging Levels
The default logging level is warn
which will cause libOmexMeta to display all
logging messages with a precedence level equal to or greater than warn
. The logging
levels and their precedence levels are:
trace
= 0
debug
= 1
info
= 2
warn
= 3
err
= 4
critical
= 5
off
= 6
Users can choose their preferred logging level.
# Switching logging levels
from pyomexmeta import RDF, Logger, eLogLevel
cellml = '''<?xml version=\"1.1\" encoding=\"UTF-8\"?>
<model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">
<component name=\"main\">
<variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />
<variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />
<variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />
</component>
</model>'''
# changing the logging level to critical is one way to hide error messages or messages with lower precedence
Logger.set_level(eLogLevel.critical)
rdf = RDF.from_string(cellml, syntax="ntriples") # See console - nothing is emitted
# turning the logger ff is another
Logger.set_level(eLogLevel.off)
rdf = RDF.from_string(cellml, syntax="ntriples") # See console - nothing is emitted
// Switching logging levels
#include "omexmeta/OmexMeta.h"
using namespace omexmeta;
int main(){
std::string cellml = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"
" <model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">\n"
" <component name=\"main\">\n"
" <variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />\n"
" </component>\n"
" </model>";
// changing the logging level to critical is one way to hide error messages or messages with lower precedence
Logger::getLogger()->setLevel(LogLevel::critical);
RDF rdf1 = RDF::fromString(cellml, "turtle"); // See console - nothing is emitted
// turning the logger off is another
Logger::getLogger()->setLevel(LogLevel::off);
RDF rdf2 = RDF::fromString(cellml, "turtle"); // See console - nothing is emitted
return 0;
}
// Switching logging levels
#include "omexmeta/OmexMetaCApi.h"
using namespace omexmeta;
int main(){
const char* cellml = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"
" <model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">\n"
" <component name=\"main\">\n"
" <variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />\n"
" </component>\n"
" </model>";
// changing the logging level to critical is one way to hide error messages or messages with lower precedence
Logger_setLevel(LogLevel::critical);
RDF* rdf1 = RDF_fromString(cellml, "turtle"); // See Python console - nothing is emitted
// turning the logger off is another
Logger_setLevel(LogLevel::off);
RDF* rdf2 = RDF_fromString(cellml, "turtle"); // See Python console - nothing is emitted
return 0;
}
Custom Formatting
Users can choose how the logging messages are formatted. Logging in libOmexMeta is handled by a dependency library called spdlog. Users should see their documentation for a list of valid formatting symbols and their purpose.
# custom logging formatter
from pyomexmeta import RDF, Logger, eLogLevel
cellml = '''<?xml version=\"1.1\" encoding=\"UTF-8\"?>
<model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">
<component name=\"main\">
<variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />
<variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />
<variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />
</component>
</model>'''
# users can customize the formatting of the logger
# See https://github.com/gabime/spdlog/wiki/3.-Custom-formatting#pattern-flags
# for more information on the supported symbols and their meanings
Logger.set_formatter("%^ [%H-%M-%S] - %t - %P - %n - %l : %v %$")
rdf = RDF.from_string(cellml, syntax="rdfxml")
[16-33-36] - 8008 - 12964 - console - warning : XML parser warning: Unsupported version '1.1'
// custom logging formatter
#include "omexmeta/OmexMeta.h"
using namespace omexmeta;
int main(){
std::string cellml = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"
" <model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">\n"
" <component name=\"main\">\n"
" <variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />\n"
" </component>\n"
" </model>";
// users can customize the formatting of the logger;
// See https://github.com/gabime/spdlog/wiki/3.-Custom-formatting//pattern-flags;
// for more information on the supported symbols and their meanings;
Logger::getLogger()->setFormatter("%^ [%H-%M-%S] - %t - %P - %n - %l : %v %$");
RDF rdf = RDF::fromString(cellml, "turtle");
return 0;
}
[16-33-50] - 668 - 29820 - console - error : syntax error at '<'
// custom logging formatter
#include "omexmeta/OmexMetaCApi.h"
using namespace omexmeta;
int main(){
const char* cellml = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"
" <model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">\n"
" <component name=\"main\">\n"
" <variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />\n"
" </component>\n"
" </model>";
// users can customize the formatting of the logger;
// See https://github.com/gabime/spdlog/wiki/3.-Custom-formatting//pattern-flags;
// for more information on the supported symbols and their meanings;
Logger_setFormatter("%^ [%H-%M-%S] - %t - %P - %n - %l : %v %$");
RDF* rdf = RDF_fromString(cellml, "turtle");
return 0;
}
[16-33-49] - 18536 - 31132 - console - error : syntax error at '<'
Switching to the file logger
Users can optionally redirect logging messages to a file of their choosing. Activating the file logger automatically deactivates the console logger, and reactivating the console logger disables the file logger. Properties such as current logging level and formatting strings are preserved when switching between the file and console loggers.
# switching to the file logger
from os.path import join, exists, dirname, abspath
from os import remove, getcwd
from pyomexmeta import RDF, Logger
cellml = '''<?xml version=\"1.1\" encoding=\"UTF-8\"?>
<model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">
<component name=\"main\">
<variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />
<variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />
<variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />
</component>
</model>'''
logger_file = join(getcwd(), "log.log")
print(f"Logger file is: \"{logger_file}\"")
# if already exists, remove
if exists(logger_file):
remove(logger_file)
assert not exists(logger_file)
# activate the file logger
Logger.file_logger(logger_file)
rdf = RDF.from_string(cellml, syntax="turtle") # nothing is emitted to console
# ensure logging content has been written to disk
Logger.flush()
# now check logger_file
print(f"Reading logging data from \"{logger_file}\":")
with open(logger_file) as f:
print(f.read())
# now activate the console logger again
Logger.console_logger()
print("Switching back to the console logger:")
rdf = RDF.from_string(cellml, syntax="turtle") # and our log message is back
[16:33:36 +01:00] error : syntax error at '<'
Logger file is: "D:\libOmexMeta\cmake-build-release\docs\log.log"
Reading logging data from "D:\libOmexMeta\cmake-build-release\docs\log.log":
[16:33:36 +01:00] error : syntax error at '<'
Switching back to the console logger:
// switching to the file logger
#include "omexmeta/OmexMeta.h"
#include <filesystem>
using namespace omexmeta;
int main(){
std::string cellml = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"
" <model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">\n"
" <component name=\"main\">\n"
" <variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />\n"
" </component>\n"
" </model>";
// Users can opt to switch to a file logger instead;
// Formatters are remembered from the previous logger;
std::filesystem::path fname = std::filesystem::current_path() / "log.log";
std::cout << "check logger filename: " << fname << std::endl;
if (std::filesystem::exists(fname)) {
std::filesystem::remove(fname);
}
Logger::getLogger()->fileLogger(fname);
RDF rdf = RDF::fromString(cellml, "turtle");
// now check Logger::getLogger()::file;
return 0;
}
check logger filename: "D:\\libOmexMeta\\cmake-build-release\\docs\\log.log"
// switching to the file logger
#include "omexmeta/OmexMetaCApi.h"
#include <filesystem>
using namespace omexmeta;
int main(){
const char* cellml = "<?xml version=\"1.1\" encoding=\"UTF-8\"?>\n"
" <model xmlns=\"http://www.cellml.org/cellml/1.1#\" xmlns:cmeta=\"http://www.cellml.org/metadata/1.0#\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:bqs=\"http://www.cellml.org/bqs/1.0#\" xmlns:semsim=\"http://bime.uw.edu/semsim/#\" xmlns:dc=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" name=\"annotation_examples\" cmeta:id=\"annExamples\">\n"
" <component name=\"main\">\n"
" <variable cmeta:id=\"main.Volume\" initial_value=\"100\" name=\"Volume\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.MembraneVoltage\" initial_value=\"-80\" name=\"MembraneVoltage\" units=\"dimensionless\" />\n"
" <variable cmeta:id=\"main.ReactionRate\" initial_value=\"1\" name=\"ReactionRate\" units=\"dimensionless\" />\n"
" </component>\n"
" </model>";
// Users can opt to switch to a file logger instead;
// Formatters are remembered from the previous logger;
// (cheat and use c++ to get a valid filepath and simplify the example)
std::filesystem::path fname = std::filesystem::current_path() / "log.log";
const char* logger_file = fname.string().c_str();
printf("check logger_file: %s\n" , logger_file);
if (std::filesystem::exists(fname)) {
std::filesystem::remove(logger_file);
}
Logger_fileLogger(logger_file);
RDF* rdf = RDF_fromString(cellml, "turtle");
// now check logger_file;
return 0;
}
check logger_file: D:\libOmexMeta\cmake-build-release\docs\log.log
Using the logger
The logger is also available for use in your own programs.
# using the logger
from pyomexmeta import RDF, Logger, eLogLevel
Logger.set_level(eLogLevel.trace) # switch to trace log level
Logger.trace("trace message")
Logger.info("info message")
Logger.debug("debug message")
Logger.warn("warn message")
Logger.error("error message")
Logger.critical("critical message")
[16:33:36 +01:00] trace : trace message
[16:33:36 +01:00] info : info message
[16:33:36 +01:00] debug : debug message
[16:33:36 +01:00] warning : warn message
[16:33:36 +01:00] error : error message
[16:33:36 +01:00] critical : critical message
#include "omexmeta/OmexMeta.h"
using namespace omexmeta;
int main(){
Logger::getLogger()->setLevel(LogLevel::trace); // switch to trace log level;
// you can also use the logger yourself, if needed;
Logger::getLogger()->trace("trace message");
Logger::getLogger()->info("info message");
Logger::getLogger()->debug("debug message");
Logger::getLogger()->warn("warn message");
Logger::getLogger()->error("error message");
Logger::getLogger()->critical("critical message");
return 0;
}
[16:33:50 +01:00] trace : trace message
[16:33:50 +01:00] info : info message
[16:33:50 +01:00] debug : debug message
[16:33:50 +01:00] warning : warn message
[16:33:50 +01:00] error : error message
[16:33:50 +01:00] critical : critical message
// using the logger
#include "omexmeta/OmexMetaCApi.h"
using namespace omexmeta;
int main(){
Logger_setLevel(LogLevel::trace); // switch to trace log level;
// you can also use the logger yourself, if needed;
Logger_trace("trace message");
Logger_info("info message");
Logger_debug("debug message");
Logger_warn("warn message");
Logger_error("error message");
Logger_critical("critical message");
return 0;
}
[16:33:50 +01:00] trace : trace message
[16:33:50 +01:00] info : info message
[16:33:50 +01:00] debug : debug message
[16:33:50 +01:00] warning : warn message
[16:33:50 +01:00] error : error message
[16:33:50 +01:00] critical : critical message