Corrade::Utility::AndroidLogStreamBuffer class

Stream buffer that sends the data to Android log.

Usable in conjunction with std::ostream to redirect the output to Android log buffer, which can later be accessed through the adb logcat utility. The data are sent on each std::ostream::flush() call (which is called implicitly on each std::endl) and then the internal buffer is cleared. Example usage:

Utility::AndroidLogStreamBuffer buffer{
    Utility::AndroidLogStreamBuffer::LogPriority::Info, "my-application"};

std::ostream out{&buffer};

out << "Hello World!" << std::endl;

From the console you can then use adb logcat and filter out everything except the "my-application" tag. The output might then look like this:

$ adb logcat *:S my-application
...
03-16 17:02:21.203 16442 16442 I my-application: Hello World!

The output stream can be also used with Debug classes — simply pass the std::ostream instance to the constructor.

Public types

enum class LogPriority: std::int32_t { Verbose = ANDROID_LOG_VERBOSE, Debug = ANDROID_LOG_DEBUG, Info = ANDROID_LOG_INFO, Warning = ANDROID_LOG_WARN, Error = ANDROID_LOG_ERROR, Fatal = ANDROID_LOG_FATAL }
Log level.

Constructors, destructors, conversion operators

AndroidLogStreamBuffer(LogPriority priority, std::string tag) explicit
Constructor.

Enum documentation

enum class Corrade::Utility::AndroidLogStreamBuffer::LogPriority: std::int32_t

Log level.

Enumerators
Verbose

Verbose debug message

Debug

Debug message

Info

Information

Warning

Warning

Error

Error

Fatal

Fatal error

Function documentation

Corrade::Utility::AndroidLogStreamBuffer::AndroidLogStreamBuffer(LogPriority priority, std::string tag) explicit

Constructor.

Parameters
priority Log priority
tag Message tag