|
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 diagnostic 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 diagnostic logging statements. More... | |
class | b64 |
Class for inserting binary regions types into Pantheios diagnostic logging statements. More... | |
class | blob |
Class for inserting binary regions types into Pantheios diagnostic logging statements. More... | |
class | boolean |
Class for inserting Boolean types into Pantheios diagnostic logging statements. More... | |
class | character |
Class for inserting characters into Pantheios diagnostic logging statements. More... | |
struct | fmt |
Format constants used by Pantheios inserter classes. More... | |
class | hex_ptr |
[DEPRECATED] Class for inserting pointers into Pantheios diagnostic logging statements. More... | |
class | integer |
Class for inserting integral types into Pantheios diagnostic logging statements. More... | |
class | pointer |
Class for inserting pointers into Pantheios diagnostic logging statements. More... | |
class | real |
Class for inserting floating-point types into Pantheios diagnostic logging statements. More... | |
class | w2m |
Class for inserting wide strings into Pantheios diagnostic logging statements. More... | |
Defines | |
#define | PANTHEIOS_LPAD(var, minWidth) ( ::pantheios::pad(var, minWidth)), (var) |
Inserts a variable with a minimum width, padding to the left with spaces. | |
#define | PANTHEIOS_RPAD(var, minWidth) (var), ( ::pantheios::pad(var, minWidth)) |
Inserts a variable with a minimum width, padding to the right with spaces. | |
Typedefs | |
typedef character | ch |
Class for inserting characters into Pantheios diagnostic logging statements. | |
typedef stlsoft::string_view | m2w |
Class for inserting wide strings into Pantheios diagnostic logging statements. | |
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. |
#define PANTHEIOS_LPAD | ( | var, | |||
minWidth | ) | ( ::pantheios::pad(var, minWidth)), (var) |
Inserts a variable with a minimum width, padding to the left with spaces.
var | The variable to be inserted | |
minWidth | The minimum width of the inserted variable |
#define PANTHEIOS_RPAD | ( | var, | |||
minWidth | ) | (var), ( ::pantheios::pad(var, minWidth)) |
Inserts a variable with a minimum width, padding to the right with spaces.
var | The variable to be inserted | |
minWidth | The minimum width of the inserted variable |
typedef character ch |
Class for inserting characters into Pantheios diagnostic logging statements.
This class converts a character variable into a string, thereby enabling it to be inserted into a logging statement. Consider the following statement:
char c = '#'; char s[] = "abc"; std::string str("def"); pantheios::log(pantheios::notice, "s=", s, ", c=", pantheios::character(c), ", str=", str);
This will produce the output:
s=abc, c=#, str=def
typedef stlsoft:: string_view m2w |
Class for inserting wide strings into Pantheios diagnostic logging statements.
This class converts a m2w variable into a string, thereby enabling it to be inserted into a logging statement. Consider the following statement:
char s[] = "abc"; wchar_t ws = L"def"; std::wstring wstr(L"ghi"); pantheios::log(pantheios::notice, L"s=", pantheios::m2w(s), L", ws=", ws, L", wstr=", wstr);
This will produce the output:
s=abc, ws=def, str=ghi
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 & Synesis Software, 2006-2011 |