Loading...
Searching...
No Matches
XrdSysTrace Class Reference

`#include <XrdSysTrace.hh>`

Collaboration diagram for XrdSysTrace:

## Public Types

typedef void(* | msgCB_t) (const char *tid, const char *msg, bool dbgmsg)

## Public Member Functions

| XrdSysTrace (const char *pfx, XrdSysLogger *logp=0, int tf=0)
| ~XrdSysTrace ()
XrdSysTrace & | Beg (const char *usr=0, const char *epn=0, const char *txt=0)
XrdSysTrace * | End ()
XrdSysTrace & | operator<< (bool val)
XrdSysTrace & | operator<< (char val)
XrdSysTrace & | operator<< (const char *val)
XrdSysTrace & | operator<< (const std::string &val)
XrdSysTrace & | operator<< (double val)
XrdSysTrace & | operator<< (float val)
XrdSysTrace & | operator<< (int val)
XrdSysTrace & | operator<< (long double val)
XrdSysTrace & | operator<< (long long val)
XrdSysTrace & | operator<< (long val)
XrdSysTrace & | operator<< (short val)
XrdSysTrace & | operator<< (unsigned int val)
XrdSysTrace & | operator<< (unsigned long long val)
XrdSysTrace & | operator<< (unsigned long val)
XrdSysTrace & | operator<< (unsigned short val)
XrdSysTrace & | operator<< (void *val)
XrdSysTrace & | operator<< (Xrd::Fmt val)
XrdSysTrace & | operator<< (XrdSysTrace *stp)
void | SetLogger (msgCB_t cbP)
void | SetLogger (XrdSysLogger *logp)
bool | Tracing (int mask)

## Public Attributes

int | What

## Detailed Description

Definition at line 48 of file XrdSysTrace.hh.

## Member Typedef Documentation

## msgCB_t

typedef void(* XrdSysTrace::msgCB_t) (const char *tid, const char *msg, bool dbgmsg)

Definition at line 58 of file XrdSysTrace.hh.

## Constructor & Destructor Documentation

## XrdSysTrace()

XrdSysTrace::XrdSysTrace | ( | const char * | pfx,
|  | XrdSysLogger * | logp = 0,
|  | int | tf = 0 )

inline

Definition at line 95 of file XrdSysTrace.hh.

: What(tf), logP(logp), iName(pfx), dPnt(0),
dFree(txtMax), vPnt(1), doFmt(Xrd::dec) {}
XrdSysTrace::What
int What
Definition XrdSysTrace.hh:64
Xrd::dec
@ dec
Definition XrdSysTrace.hh:42

References What.

Referenced by Beg(), End(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), operator<<(), and operator<<().

Here is the caller graph for this function:

## ~XrdSysTrace()

XrdSysTrace::~XrdSysTrace | ( |  | ) |

inline

Definition at line 98 of file XrdSysTrace.hh.

{}

## Member Function Documentation

## Beg()

XrdSysTrace & XrdSysTrace::Beg | ( | const char * | usr = 0,
|  | const char * | epn = 0,
|  | const char * | txt = 0 )

Definition at line 73 of file XrdSysTrace.cc.

{
char fmt[16];
const char *fmt1, *fmt2, *fmt3;
int n;
// Generate prefix format (way too complicated)
//
if (usr) fmt1 = "%s ";
else {usr = "", fmt1 = "%s";}
if (epn) fmt2 = "%s_%s: ";
else {epn = ""; fmt2 = "%s%s: ";}
if (txt) fmt3 = "%s";
else {txt = ""; fmt3 = "";}
sprintf(fmt, "%s%s%s", fmt1, fmt2, fmt3);
// Format the header
//
myMutex.Lock();
n = snprintf(pBuff, sizeof(pBuff), fmt, usr, iName, epn, txt);
if (n >= (int)sizeof(pBuff)) n = sizeof(pBuff)-1;
// Start the trace procedure
//
ioVec[0].iov_base = 0; ioVec[0].iov_len = 0;
ioVec[1].iov_base = pBuff; ioVec[1].iov_len = n;
// Reset ourselves
//
dPnt = 0;
dFree = txtMax;
vPnt = 2;
// All done
//
return *this;
}

References XrdSysTrace().

Here is the call graph for this function:

## End()

XrdSysTrace * XrdSysTrace::End | ( |  | ) |

inline

Definition at line 54 of file XrdSysTrace.hh.

{return this;}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [1/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | bool | val | ) |

Definition at line 145 of file XrdSysTrace.cc.

{
// If we have enough space then format the value
//
if (vPnt < iovMax)
{if (val)
{ioVec[vPnt] .iov_base = (char *)"True";
ioVec[vPnt++].iov_len = 4;
} else {
ioVec[vPnt] .iov_base = (char *)"False";
ioVec[vPnt++].iov_len = 5;
}
}
return *this;
}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [2/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | char | val | ) |

Definition at line 166 of file XrdSysTrace.cc.

{
static const char hv[] = "0123456789abcdef";
// If we have enough space then format the value
//
if (vPnt < iovMax && dFree > 1)
{if (doFmt)
{if (doFmt & Xrd::hex)
{ioVec[vPnt].iov_base = (char *)(&dBuff[dPnt]);
if (doFmt & Xrd::hex)
{ioVec[vPnt++].iov_len = 2;
dBuff[dPnt++] = hv[(val >> 4) & 0x0f];
dBuff[dPnt++] = hv[ val & 0xf0];
dFree -= 2;
} else if (doFmt & Xrd::oct && dFree > 2) {
ioVec[vPnt++].iov_len = 3;
dBuff[dPnt+2] = hv[val & 0x07]; val >>= 3;
dBuff[dPnt+1] = hv[val & 0x07]; val >>= 3;
dBuff[dPnt+1] = hv[val & 0x03];
dPnt += 3;
dFree -= 3;
}
}
if (doFmt & doOne) doFmt = Xrd::dec;
} else {
ioVec[vPnt] .iov_base = (char *)(&dBuff[dPnt]);
ioVec[vPnt++].iov_len = 1;
dBuff[dPnt++] = val; dFree--;
}
}
return *this;
}
Xrd::oct
@ oct
Definition XrdSysTrace.hh:42
Xrd::hex
@ hex
Definition XrdSysTrace.hh:42

References XrdSysTrace(), Xrd::dec, Xrd::hex, and Xrd::oct.

Here is the call graph for this function:

## operator<<() [3/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | const char * | val | ) |

Definition at line 204 of file XrdSysTrace.cc.

{
// If we have enough space then format the value
//
if (vPnt < iovMax)
{ioVec[vPnt] .iov_base = (char *)val;
ioVec[vPnt++].iov_len = strlen(val);
}
return *this;
}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [4/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | const std::string & | val | ) |

Definition at line 220 of file XrdSysTrace.cc.

{
return (*this << val.c_str());
}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [5/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | double | val | ) |

inline

Definition at line 84 of file XrdSysTrace.hh.

{return Insert(static_cast<long double>(val));}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [6/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | float | val | ) |

inline

Definition at line 82 of file XrdSysTrace.hh.

{return Insert(static_cast<long double>(val));}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [7/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | int | val | ) |

Definition at line 252 of file XrdSysTrace.cc.

{
static const int xSz = sizeof("-2147483648");
// If we have enough space then format the value
//
if (dFree >= xSz && vPnt < iovMax)
{const char *fmt = (doFmt ? (doFmt & Xrd::hex ? "%x" : "%o") : "%d");
int n = snprintf(&dBuff[dPnt], dFree, fmt, val);
if (n > dFree) dFree = 0;
else {ioVec[vPnt] .iov_base = &dBuff[dPnt];
ioVec[vPnt++].iov_len = n;
dPnt += n; dFree -= n;
}
}
if (doFmt & doOne) doFmt = Xrd::dec;
return *this;
}

References XrdSysTrace(), Xrd::dec, and Xrd::hex.

Here is the call graph for this function:

## operator<<() [8/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | long double | val | ) |

inline

Definition at line 86 of file XrdSysTrace.hh.

{return Insert(val);}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [9/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | long long | val | ) |

Definition at line 288 of file XrdSysTrace.cc.

{
static const int xSz = sizeof("-9223372036854775808");
// If we have enough space then format the value
//
if (dFree >= xSz && vPnt < iovMax)
{const char *fmt = (doFmt ? (doFmt & Xrd::hex ? "%llx" : "%llo") : "%lld");
int n = snprintf(&dBuff[dPnt], dFree, fmt, val);
if (n > dFree) dFree = 0;
else {ioVec[vPnt] .iov_base = &dBuff[dPnt];
ioVec[vPnt++].iov_len = n;
dPnt += n; dFree -= n;
}
}
if (doFmt & doOne) doFmt = Xrd::dec;
return *this;
}

References XrdSysTrace(), Xrd::dec, and Xrd::hex.

Here is the call graph for this function:

## operator<<() [10/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | long | val | ) |

Definition at line 275 of file XrdSysTrace.cc.

{
// Fan out based on length of a long
//
if (sizeof(long) > 4) return *this<<static_cast<long long>(val);
else return *this<<static_cast<int>(val);
}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [11/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | short | val | ) |

Definition at line 229 of file XrdSysTrace.cc.

{
static const int xSz = sizeof("-32768");
// If we have enough space then format the value
//
if (dFree >= xSz && vPnt < iovMax)
{const char *fmt = (doFmt ? (doFmt & Xrd::hex ? "%hx" : "%ho") : "%hd");
int n = snprintf(&dBuff[dPnt], dFree, fmt, val);
if (n > dFree) dFree = 0;
else {ioVec[vPnt] .iov_base = &dBuff[dPnt];
ioVec[vPnt++].iov_len = n;
dPnt += n; dFree -= n;
}
}
if (doFmt & doOne) doFmt = Xrd::dec;
return *this;
}

References XrdSysTrace(), Xrd::dec, and Xrd::hex.

Here is the call graph for this function:

## operator<<() [12/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | unsigned int | val | ) |

Definition at line 334 of file XrdSysTrace.cc.

{
static const int xSz = sizeof("4294967295");
// If we have enough space then format the value
//
if (dFree >= xSz && vPnt < iovMax)
{const char *fmt = (doFmt ? (doFmt & Xrd::hex ? "%x" : "%o") : "%u");
int n = snprintf(&dBuff[dPnt], dFree, fmt, val);
if (n > dFree) dFree = 0;
else {ioVec[vPnt] .iov_base = &dBuff[dPnt];
ioVec[vPnt++].iov_len = n;
dPnt += n; dFree -= n;
}
}
if (doFmt & doOne) doFmt = Xrd::dec;
return *this;
}

References XrdSysTrace(), Xrd::dec, and Xrd::hex.

Here is the call graph for this function:

## operator<<() [13/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | unsigned long long | val | ) |

Definition at line 370 of file XrdSysTrace.cc.

{
static const int xSz = sizeof("18446744073709551615");
// If we have enough space then format the value
//
if (dFree >= xSz && vPnt < iovMax)
{const char *fmt = (doFmt ? (doFmt & Xrd::hex ? "%llx" : "%llo") : "%llu");
int n = snprintf(&dBuff[dPnt], dFree, fmt, val);
if (n > dFree) dFree = 0;
else {ioVec[vPnt] .iov_base = &dBuff[dPnt];
ioVec[vPnt++].iov_len = n;
dPnt += n; dFree -= n;
}
}
if (doFmt & doOne) doFmt = Xrd::dec;
return *this;
}

References XrdSysTrace(), Xrd::dec, and Xrd::hex.

Here is the call graph for this function:

## operator<<() [14/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | unsigned long | val | ) |

Definition at line 357 of file XrdSysTrace.cc.

{
// Fan out based on length of a long
//
if (sizeof(long) > 4) return *this<<static_cast<unsigned long long>(val);
else return *this<<static_cast<unsigned int>(val);
}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [15/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | unsigned short | val | ) |

Definition at line 311 of file XrdSysTrace.cc.

{
static const int xSz = sizeof("65535");
// If we have enough space then format the value
//
if (dFree >= xSz && vPnt < iovMax)
{const char *fmt = (doFmt ? (doFmt & Xrd::hex ? "%hx" : "%ho") : "%hu");
int n = snprintf(&dBuff[dPnt], dFree, fmt, val);
if (n > dFree) dFree = 0;
else {ioVec[vPnt] .iov_base = &dBuff[dPnt];
ioVec[vPnt++].iov_len = n;
dPnt += n; dFree -= n;
}
}
if (doFmt & doOne) doFmt = Xrd::dec;
return *this;
}

References XrdSysTrace(), Xrd::dec, and Xrd::hex.

Here is the call graph for this function:

## operator<<() [16/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | void * | val | ) |

Definition at line 393 of file XrdSysTrace.cc.

{
static const int xSz = sizeof(void *)*2+1;
// If we have enough space then format the value
//
if (dFree >= xSz && vPnt < iovMax)
{int n = snprintf(&dBuff[dPnt], dFree, "%p", val);
if (n > dFree) dFree = 0;
else {ioVec[vPnt] .iov_base = &dBuff[dPnt];
ioVec[vPnt++].iov_len = n;
dPnt += n; dFree -= n;
}
}
return *this;
}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [17/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | Xrd::Fmt | val | ) |

inline

Definition at line 91 of file XrdSysTrace.hh.

{doFmt = val; return *this;}

References XrdSysTrace().

Here is the call graph for this function:

## operator<<() [18/18]

XrdSysTrace & XrdSysTrace::operator<< | ( | XrdSysTrace * | stp | ) |

Definition at line 117 of file XrdSysTrace.cc.

{
(void)val;
// Make sure an endline character appears
//
if (vPnt >= iovMax) vPnt = iovMax-1;
ioVec[vPnt] .iov_base = (char *)"\n";
ioVec[vPnt++].iov_len = 1;
// Output the line
//
if (logP) logP->Put(vPnt, ioVec);
else if (msgCB) ToMsgCB(vPnt, ioVec);
else {static XrdSysLogger tLog(XrdSysFD_Dup(STDERR_FILENO), 0);
tLog.Put(vPnt, ioVec);
}
// All done
//
myMutex.UnLock();
return *this;
}

References XrdSysTrace(), and XrdSysLogger::Put().

Here is the call graph for this function:

## SetLogger() [1/2]

void XrdSysTrace::SetLogger | ( | msgCB_t | cbP | ) |

Definition at line 67 of file XrdSysTrace.cc.

{msgCB = cbP;}
XrdSsi::msgCB
XrdSsiLogger::MCB_t * msgCB
Definition XrdSsiLogger.cc:59

## SetLogger() [2/2]

void XrdSysTrace::SetLogger | ( | XrdSysLogger * | logp | ) |

Definition at line 65 of file XrdSysTrace.cc.

{logP = logp;}

## Tracing()

bool XrdSysTrace::Tracing | ( | int | mask | ) |

inline

Definition at line 62 of file XrdSysTrace.hh.

{return (mask & What) != 0;}

References What.

## Member Data Documentation

## What

int XrdSysTrace::What

Definition at line 64 of file XrdSysTrace.hh.

Referenced by XrdSysTrace(), and Tracing().

The documentation for this class was generated from the following files:

- XrdSysTrace.hh
- XrdSysTrace.cc