hpx/logging/format/formatters.hpp

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace util
namespace logging
namespace formatter

Formatter is a manipulator. It allows you to format the message before writing it to the destination(s)

Examples of formatters are : prepend the time, prepend high-precision time, prepend the index of the message, etc.

struct high_precision_time : public hpx::util::logging::formatter::manipulator
#include <formatters.hpp>

Prefixes the message with a high-precision time (. You pass the format string at construction.

#include <hpx/logging/format/formatters.hpp>

Internally, it uses hpx::util::date_time::microsec_time_clock. So, our precision matches this class.

The format can contain escape sequences: $dd - day, 2 digits $MM - month, 2 digits $yy - year, 2 digits $yyyy - year, 4 digits $hh - hour, 2 digits $mm - minute, 2 digits $ss - second, 2 digits $mili - milliseconds $micro - microseconds (if the high precision clock allows; otherwise, it pads zeros) $nano - nanoseconds (if the high precision clock allows; otherwise, it pads zeros)

Example:

high_precision_time("$mm:$ss:$micro");

Parameters
  • convert: [optional] In case there needs to be a conversion between std::(w)string and the string that holds your logged message. See convert_format.

Public Functions

~high_precision_time()

Public Static Functions

static std::unique_ptr<high_precision_time> make(std::string const &format)

Protected Functions

high_precision_time(std::string const &format)
struct idx : public hpx::util::logging::formatter::manipulator
#include <formatters.hpp>

prefixes each message with an index.

Example:

L_ << "my message";
L_ << "my 2nd message";

This will output something similar to:

[1] my message
[2] my 2nd message

Public Functions

~idx()

Public Static Functions

static std::unique_ptr<idx> make()

Protected Functions

idx()
struct thread_id : public hpx::util::logging::formatter::manipulator
#include <formatters.hpp>

Writes the thread_id to the log.

Parameters
  • convert: [optional] In case there needs to be a conversion between std::(w)string and the string that holds your logged message. See convert_format.

Public Functions

~thread_id()

Public Static Functions

static std::unique_ptr<thread_id> make()

Protected Functions

thread_id()