Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

Logging


The logging system provides logging.

Currently all logs are just dumped to standard output. In the future I'll add in some more logging stuff, like saving logs to a file.

It's possible to assign the system from which the logging statement originates, as well as the logging statements severity. Logs then can be filtered based on the system and severity.

Severities


Info | SEVERITY_INFO

For very verbose debugging purposes. Useful to dump anything and everything. Filtered out by default.

Warning | SEVERITY_WARNING

For things that should be looked at, such as the use of deprecated functionality, missing files and such.

Error | SEVERITY_ERROR

For things that are ungood, but can be recovered from, such as errors with file formatting, incorrect usage of functionality and such.

Doubleplus Ungood Error | SEVERITY_CRITICAL_ERROR

For errors that can't be recovered from. Useful to log some final data before aborting the application.

Programming in C++


#include <framework/logging.h>
API documentation page.

// filter out everything coming from the Platform
// system that has a severity which is lower than
// error, i.e. infos and warnings.
SetSystemLoggingSeverity(System::SYSTEM_PLATFORM,
                         SEVERITY_ERROR);

float number = 420.0f;
const char* string = "mongus";

// will log: mongus has 420 bananas
Log("{} has {} bananas.", number, string);

// will log: hi!
// but due to our filtering settings this will
// be filtered out
Log(System::SYSTEM_PLATFORM, SEVERITY_INFO, "hi!");