#include <XrdOucERoute.hh>
|
static int | Format (char *buff, int blen, int ecode, const char *etxt1, const char *etxt2=0) |
|
static int | Route (XrdSysError *elog, XrdOucStream *estrm, const char *esfx, int ecode, const char *etxt1, const char *etxt2=0) |
|
Definition at line 36 of file XrdOucERoute.hh.
◆ XrdOucERoute()
XrdOucERoute::XrdOucERoute |
( |
| ) |
|
|
inline |
◆ ~XrdOucERoute()
XrdOucERoute::~XrdOucERoute |
( |
| ) |
|
|
inline |
◆ Format()
int XrdOucERoute::Format |
( |
char * | buff, |
|
|
int | blen, |
|
|
int | ecode, |
|
|
const char * | etxt1, |
|
|
const char * | etxt2 = 0 ) |
|
static |
Format an error message into a buffer in the form of: "Unable to <etxt1> <etxt2>; <syserror[enum]>"
- Parameters
-
buff | pointer to the buffer where the msg is to be placed. |
blen | the length of the buffer. |
ecode | the error number associated iwth the error. |
etxt1 | associated text token #1. |
etxt2 | associated text token #2 (optional). |
- Returns
- <int> The number of characters placed in the buffer less null.
Definition at line 44 of file XrdOucERoute.cc.
46{
48 char ebuff[256];
49 int n;
50
51
52
53 if (!estr) estr = "reason unknown";
54 else if (isupper(static_cast<int>(*estr)))
55 {
strlcpy(ebuff, estr,
sizeof(ebuff));
56 *ebuff = static_cast<char>(tolower(static_cast<int>(*estr)));
57 estr = ebuff;
58 }
59
60
61
62 if (!etxt2) etxt2 = esep = "";
63
64
65
66 n = snprintf(buff, blen, "Unable to %s%s%s; %s",etxt1,esep,etxt2,estr);
67 return (n < blen ? n : blen-1);
68}
static const char * ec2text(int ecode)
References XrdSysError::ec2text(), and strlcpy().
Referenced by XrdOfs::Emsg(), XrdSsiUtils::Emsg(), and Route().
◆ Route()
int XrdOucERoute::Route |
( |
XrdSysError * | elog, |
|
|
XrdOucStream * | estrm, |
|
|
const char * | esfx, |
|
|
int | ecode, |
|
|
const char * | etxt1, |
|
|
const char * | etxt2 = 0 ) |
|
static |
Format an error message using Format() and route it as requested.
- Parameters
-
elog | pointer to the XrdSysError object to use to route the message to the log, If null, the message isn't routed there. |
estrm | pointer to the XrdOucStrean object which is to receive the error message text or null if none exists. |
esfx | The suffix identifier to use when routing to the log. |
ecode | the error number associated iwth the error. |
etxt1 | associated text token #1. |
etxt2 | associated text token #2 (optional). |
- Returns
- <int> The -abs(enum) or -1 if enum is zero.
Definition at line 74 of file XrdOucERoute.cc.
77{
78 char ebuff[2048];
79 int elen;
80
81
82
83 elen =
Format(ebuff,
sizeof(ebuff), ecode, etxt1, etxt2);
84
85
86
87 if (elog) elog->
Emsg(esfx, ebuff);
88 if (estrm) estrm->
Put(ebuff, elen);
89
90
91
92 if (ecode) return (ecode < 0 ? ecode : -ecode);
93 return -1;
94}
static int Format(char *buff, int blen, int ecode, const char *etxt1, const char *etxt2=0)
int Put(const char *data, const int dlen)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
References XrdSysError::Emsg(), Format(), and XrdOucStream::Put().
The documentation for this class was generated from the following files: