#include <XrdSysLogger.hh>
Collaboration diagram for XrdSysLogger:
Public Member Functions | |
XrdSysLogger (int ErrFD=STDERR_FILENO, int xrotate=1) | |
~XrdSysLogger () | |
Destructor. | |
void | AddMsg (const char *msg) |
void | AtMidnight (Task *mnTask) |
int | Bind (const char *path, int lfh=0) |
void | Flush () |
Flush any pending output. | |
int | originalFD () |
int | ParseKeep (const char *arg) |
void | Put (int iovcnt, struct iovec *iov) |
void | setHiRes () |
Set log file timstamp to high resolution (hh:mm:ss.uuuu). | |
void | setKeep (long long knum) |
void | setRotate (int onoff) |
char * | traceBeg () |
char | traceEnd () |
const char * | xlogFN () |
void | zHandler () |
Static Public Member Functions | |
static void | setForwarding (bool onoff) |
Set call-out to logging plug-in on or off. | |
Static Public Attributes | |
static const int | onFifo = (int)0x80000000 |
Private Member Functions | |
int | FifoMake () |
void | FifoWait () |
int | Time (char *tbuff) |
void | putEmsg (char *msg, int msz) |
int | ReBind (int dorename=1) |
void | Trim () |
Static Private Member Functions | |
static int | TimeStamp (struct timeval &tVal, unsigned long tID, char *tbuff, int tbsz, bool hires) |
Private Attributes | |
mmMsg * | msgList |
Task * | taskQ |
XrdSysMutex | Logger_Mutex |
long long | eKeep |
char | TBuff [32] |
int | eFD |
int | baseFD |
char * | ePath |
char | Filesfx [8] |
int | eInt |
int | reserved1 |
char * | fifoFN |
bool | hiRes |
bool | doLFR |
pthread_t | lfhTID |
Static Private Attributes | |
static bool | doForward |
Classes | |
struct | mmMsg |
class | Task |
XrdSysLogger::XrdSysLogger | ( | int | ErrFD = STDERR_FILENO , |
|
int | xrotate = 1 | |||
) |
Constructor
ErrFD | is the filedescriptor of where error messages normally go if this class is not used. Default is stderr. | |
xrotate | when not zero performs internal log rotatation. Otherwise, log rotation is suppressed. See also setRotate(). |
XrdSysLogger::~XrdSysLogger | ( | ) | [inline] |
Destructor.
void XrdSysLogger::AddMsg | ( | const char * | msg | ) |
Add a message to be printed at midnight.
msg | The message to be printed. A copy of the message is saved. |
void XrdSysLogger::AtMidnight | ( | Task * | mnTask | ) |
int XrdSysLogger::Bind | ( | const char * | path, | |
int | lfh = 0 | |||
) |
int XrdSysLogger::FifoMake | ( | ) | [private] |
void XrdSysLogger::FifoWait | ( | ) | [private] |
void XrdSysLogger::Flush | ( | ) | [inline] |
Flush any pending output.
int XrdSysLogger::originalFD | ( | ) | [inline] |
Get the file descriptor passed at construction time.
int XrdSysLogger::ParseKeep | ( | const char * | arg | ) |
Parse the keep option argument.
arg | Pointer to the argument. The argument syntax is: <count> | <size> | fifo | <signame> |
=0 Invalid keep argument.
void XrdSysLogger::Put | ( | int | iovcnt, | |
struct iovec * | iov | |||
) |
Output data and optionally prefix with date/time
iovcnt | The number of elements in iov vector. | |
iov | The vector describing what to print. If iov[0].iov_base is zero, the message is prefixed by date and time. |
void XrdSysLogger::putEmsg | ( | char * | msg, | |
int | msz | |||
) | [private] |
int XrdSysLogger::ReBind | ( | int | dorename = 1 |
) | [private] |
static void XrdSysLogger::setForwarding | ( | bool | onoff | ) | [inline, static] |
Set call-out to logging plug-in on or off.
void XrdSysLogger::setHiRes | ( | ) | [inline] |
Set log file timstamp to high resolution (hh:mm:ss.uuuu).
void XrdSysLogger::setKeep | ( | long long | knum | ) | [inline] |
Set log file keep value.
knum | The keep value. If knum < 0 then abs(knum) files are kept. Otherwise, only knum bytes of log files are kept. |
void XrdSysLogger::setRotate | ( | int | onoff | ) | [inline] |
Set log file rotation on/off.
onoff | When !0 turns on log file rotations. Otherwise, rotation is turned off. |
int XrdSysLogger::Time | ( | char * | tbuff | ) | [private] |
static int XrdSysLogger::TimeStamp | ( | struct timeval & | tVal, | |
unsigned long | tID, | |||
char * | tbuff, | |||
int | tbsz, | |||
bool | hires | |||
) | [static, private] |
char* XrdSysLogger::traceBeg | ( | ) | [inline] |
Start trace message serialization. This method must be followed by a call to traceEnd().
char XrdSysLogger::traceEnd | ( | ) | [inline] |
Stop trace message serialization. This method must be preceeded by a call to traceBeg().
void XrdSysLogger::Trim | ( | ) | [private] |
const char* XrdSysLogger::xlogFN | ( | ) | [inline] |
Get the log file routing.
void XrdSysLogger::zHandler | ( | ) |
Internal method to handle the logfile. This is public because it needs to be called by an external thread.
int XrdSysLogger::baseFD [private] |
bool XrdSysLogger::doForward [static, private] |
bool XrdSysLogger::doLFR [private] |
int XrdSysLogger::eFD [private] |
int XrdSysLogger::eInt [private] |
long long XrdSysLogger::eKeep [private] |
char* XrdSysLogger::ePath [private] |
char* XrdSysLogger::fifoFN [private] |
char XrdSysLogger::Filesfx[8] [private] |
bool XrdSysLogger::hiRes [private] |
pthread_t XrdSysLogger::lfhTID [private] |
XrdSysMutex XrdSysLogger::Logger_Mutex [private] |
mmMsg* XrdSysLogger::msgList [private] |
const int XrdSysLogger::onFifo = (int)0x80000000 [static] |
Bind allows you to bind the file descriptor passed at construction time to a file with an optional periodic closing and opening of the file.
path | The log file path. The file is created, if need be. If path is null, messages are routed to stderr and the lfh argument is ignored. | |
lfh | Log file handling: >0 file is to be closed and opened at midnight. This implies automatic log rotation. =0 file is to be left open all the time. This implies no log rotation. <0 file is to be closed and opened only on signal abs(lfh) unless the value equals onFifo. In this case a fifo is used to control log file rotation. The name of the fifo is path with the filename component prefixed by dot. This implies manual log rotation. Warning! Using signals requires that Bind() be called before starting any threads so that the signal is properly blocked. |
<0 Unable to bind, returned value is -errno of the reason.
int XrdSysLogger::reserved1 [private] |
Task* XrdSysLogger::taskQ [private] |
char XrdSysLogger::TBuff[32] [private] |