uatools 1.0.0-pre2
 
Loading...
Searching...
No Matches
base.hpp File Reference

Small VLTSW-safe base utilities used by uatools/protocol log format strings (UATLOC macro, ThreadName helper, IsoTimeNow helper). More...

#include <array>
#include <chrono>
#include <cstdio>
#include <ctime>
#include <pthread.h>
#include <string>

Go to the source code of this file.

Namespaces

namespace  eso
 
namespace  eso::uatools
 
namespace  eso::uatools::protocol
 
namespace  eso::uatools::protocol::base
 

Macros

#define UATLOC
 Location identifier macro: "<iso-time>:<file>:<line>:<function>:<thread>".
 

Functions

std::string eso::uatools::protocol::base::ThreadName ()
 Return the current thread name (pthread_getname_np), or "" if unavailable. Bounded at 16 chars by the Linux pthread API.
 
std::string eso::uatools::protocol::base::IsoTimeNow (int frac_digits=6)
 Return the current UTC time as an ISO 8601 string with frac_digits fractional second digits (default 6: microseconds). Matches ifw::fnd::IsoTimeNow() semantics closely enough for log formatting purposes.
 

Detailed Description

Small VLTSW-safe base utilities used by uatools/protocol log format strings (UATLOC macro, ThreadName helper, IsoTimeNow helper).

Mirrors the semantics of ifw-fnd's FNDLOC (location string composed of "iso-time:file:line:function:thread") without depending on ifw-fnd, so the protocol library remains VLTSW-buildable.

Macro Definition Documentation

◆ UATLOC

#define UATLOC
Value:
std::string(__FILE__) + ":" + \
std::to_string(__LINE__) + ":" + \
std::string(__FUNCTION__) + ":" + \
::eso::uatools::protocol::base::ThreadName())
std::string IsoTimeNow(int frac_digits=6)
Return the current UTC time as an ISO 8601 string with frac_digits fractional second digits (default ...
Definition base.hpp:40

Location identifier macro: "<iso-time>:<file>:<line>:<function>:<thread>".

Used as a leading argument in log format strings. Mirrors the semantics of ifw-fnd's FNDLOC macro but lives in eso::uatools::protocol::base so the protocol library has no dependency on ifw-fnd.