blob: ec4dc9041d68101bb4f0d21bd693e2a3a1e62716 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include <pthread.h> /* pthread_self() */
#include "abrtlib.h"
#include "CommLayerInner.h"
static CObserver *s_pObs;
static pthread_t s_main_id;
void init_daemon_logging(CObserver *pObs)
{
s_pObs = pObs;
s_main_id = pthread_self();
}
void warn_client(const std::string& pMessage)
{
if (!s_pObs)
return;
pthread_t self = pthread_self();
if (self != s_main_id)
{
s_pObs->Warning(pMessage,(uint64_t)self);
//log("w: '%s'", s.c_str());
}
else
{
s_pObs->Warning(pMessage);
// debug: this should not happen - if it is, we are trying to log to a client
// but we have no job id!
log("W: '%s'", pMessage.c_str());
}
}
void update_client(const std::string& pMessage)
{
if (!s_pObs)
return;
pthread_t self = pthread_self();
if (self != s_main_id)
{
s_pObs->Status(pMessage, (uint64_t)self);
//log("u: '%s'", s.c_str());
}
else
{
s_pObs->Status(pMessage);
// debug: this should not happen - if it is, we are trying to log to a client
// but we have no job id!
log("U: '%s'", pMessage.c_str());
}
}
|