|
|
|
|
|
By using string access shims, strings, or those things that are expressible ( as String types, or
These classes are used to wrap instances of fundamental types in order to pass them into the Pantheios logging functions, as in:
short s = 123; int i = 456; long l = 789; float f = static_cast<float>(0.123); double d = 0.456; long double ld = 0.789; void* p = reinterpret_cast<void*>(0x01230123); unsigned char ar[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; pantheios::log_INFORMATIONAL( "This string contains: " , "some integers (", pantheios::integer(s), ", ", pantheios::integer(i, 4 | pantheios::fmt::zeroPadded), ", ", pantheios::integer(l), "); " , "some real numbers (", pantheios::real(f), ", ", pantheios::real(d), ", ", pantheios::real(ld), "); " , "a pointer (", pantheios::pointer(p, pantheios::fmt::fullHex), "); " , "and a blob (", pantheios::blob(&ar[0], sizeof(ar), ")" );
which will produce the following output:
This string contains: some integers (123, 0456, 789); some real numbers (0.123, 0.456, 0.789); a pointer (0x1230123); and a blob (0011223344)
Within the scope of a given function, it can be appropriate to use a using directive to reduce the clutter, as in:
using namespace pantheios; short s = 123; int i = 456; long l = 789; float f = static_cast<float>(0.123); double d = 0.456; long double ld = 0.789; void* p = reinterpret_cast<void*>(0x01230123); unsigned char ar[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; log_INFORMATIONAL( "This string contains: " , "some integers (", integer(s), ", ", integer(i, 4 | fmt::zeroPadded), ", ", integer(l), "); " , "some real numbers (", real(f), ", ", real(d), ", ", real(ld), "); " , "and a pointer (", pointer(p, fmt::fullHex), "); " , "and a blob (", blob(&ar[0], sizeof(ar), ")" );
or using declarations, as in:
using pantheios::log_INFORMATIONAL; using pantheios::blob; using pantheios::integer; using pantheios::real; using pantheios::pointer; using pantheios::fmt; short s = 123; int i = 456; long l = 789; float f = static_cast<float>(0.123); double d = 0.456; long double ld = 0.789; void* p = reinterpret_cast<void*>(0x01230123); unsigned char ar[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; log_INFORMATIONAL( "This string contains: " , "some integers (", integer(s), ", ", integer(i, 4 | fmt::zeroPadded), ", ", integer(l), "); " , "some real numbers (", real(f), ", ", real(d), ", ", real(ld), "); " , "and a pointer (", pointer(p, fmt::fullHex), "); " , "and a blob (", blob(&ar[0], sizeof(ar), ")" );
Classes | |
| class | args |
Class for inserting argc+argv arguments into Pantheios logging statements. More... | |
| class | b64 |
| Class for inserting binary regions types into Pantheios logging statements. More... | |
| class | blob |
| Class for inserting binary regions types into Pantheios logging statements. More... | |
| class | boolean |
| Class for inserting pointer types into Pantheios logging statements. More... | |
| class | character |
| Class for inserting characters into Pantheios logging statements. More... | |
| struct | fmt |
| Format constants used by Pantheios inserter classes. More... | |
| class | hex_ptr |
| Class for inserting pointers into Pantheios logging statements. More... | |
| class | integer |
| Class for inserting integral types into Pantheios logging statements. More... | |
| class | pointer |
| Class for inserting pointers into Pantheios logging statements. More... | |
| class | real |
| Class for inserting floating-point types into Pantheios logging statements. More... | |
Variables | |
| struct hostId_t const * | hostId |
| Global instance that may be used to insert a host identity into a log statement. | |
| struct processId_t const * | processId |
| Global instance that may be used to insert a process identity into a log statement. | |
| struct threadId_t const * | threadId |
| Global instance that may be used to insert a thread identity into a log statement. | |
| struct hostId_t const* hostId |
Global instance that may be used to insert a host identity into a log statement.
pantheios::log_NOTICE("host id=", pantheios::hostId);
This will produce output such as the following:
host id=my-system
| struct processId_t const* processId |
Global instance that may be used to insert a process identity into a log statement.
pantheios::log_NOTICE("process id=", pantheios::processId);
This will produce output such as the following:
process id=2436
| struct threadId_t const* threadId |
Global instance that may be used to insert a thread identity into a log statement.
pantheios::log_NOTICE("thread id=", pantheios::threadId);
This will produce output such as the following:
thread id=1310
|
|
|
| pantheios Library documentation © Matthew Wilson, 2006-2008 |
|