Ceetron Desktop Components and Ceetron Export provide a logging system used both for the internal logging and also available for logging errors, warnings, info and debug in your own application.
![]() | ![]() |
The logged messages can either be saved to a file (LogDestinationFile) or written directly to a console (LogDestinationConcole). You can also create your own log destination by deriving from LogDestination and overriding the log method. This is useful if you already have a logging system in your application and would like to incorporate the logging message from Ceetron toolkits into your application log.
The LogManager controls the logging. You can get the LogManager with the CoreComponent::logManager() method. Set the destination (file or console) using LogManager::setDestination().
The log manager provides 4 levels of log messages:
Each of these take a logger name and the log message. Log an error message like this:
The logger names are structured in a hierarchical system with parent/child categories which simplifies the logger level control. You can have different user defined logger names for your different modules or areas, for instance:
myComp.import
myComp.export
myComp.visual
The loggers used by Ceetron toolkits are all under the "cee." logger. The logger for each component is called "cee.comp.{COMPONENT_NAME}", e.g. cee.comp.UnstructGrid. The logger "cee.cvf.*" is used for the internal Ceetron rendering engine.
You specify the log levels to use for your application with LogManager::setLevel() with a logger name and a level (1-4). This log level will apply to the specified logger name and all its children. Consider the following code:
This will log errors and warnings globally, but also show info messages from everything under myComp.*
. Debug messages from myComp.import
will in addition be logged, but myComp.export
will still be at level 3 and just show errors, warnings and info.
Good practice is setting up the logger at the same place as you initialize Ceetron Desktop Components or Ceetron Export. Once the logger is set up, you can send log messages from anywhere using m_instance.logManager()->log*("logger name", "logger message")
.
Logger example setup from the demo application: