Commit Graph

32 Commits

Author SHA1 Message Date
Takeshi MIZUTA
4d1a98ad76 Unify to QB_TRUE/QB_FALSE a boolean value 2013-01-11 02:01:06 +09:00
Angus Salkeld
e07eccd6a6 Fix the blackbox formatter when specifing the string len/precision
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-19 10:51:54 +11:00
Angus Salkeld
c69713e5f9 Make sure we don't use the format string whilst it is getting changed.
Just add a rwlock around the usage.
Move qb_log_format_set() to log_format.c to make this easier.

Fixes #45

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-12-10 10:32:31 +11:00
Angus Salkeld
9d33e1f40d LOG: fix qb_vsnprintf_deserialize()
the strlcat was not call correctly, it needs the
original string to find the end and return the
correct length.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-09-05 18:35:19 +10:00
Angus Salkeld
a55554efb1 LOG: change qb_vsprintf_serialize() into qb_vsnprintf_serialize()
This is to prevent overwriting the ringbuffer.
Also remove stpcpy() as it is not used anymore.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-08-29 21:40:40 +10:00
Andrew Beekhof
e70e7908f0 LOG: Restrict string trucation during serialization to when a precision is specified 2012-06-07 15:02:06 +10:00
Andrew Beekhof
9b0bb4e80e LOG: Observe field widths when serializing string arguments 2012-06-07 14:40:34 +10:00
Angus Salkeld
9956fe29ff LOG: fix the printing of %p in the blackbox
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-04 14:54:39 +10:00
Angus Salkeld
9f90b16d06 blackbox: fix %p formatting
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 23:16:49 +10:00
Angus Salkeld
d280ddd6e4 LOG: put all fields in the blackbox (added priority and tags)
Fixes #36

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-28 22:23:22 +10:00
Jim Meyering
32abe38ffd avoid unwarranted use of strncpy: use memcpy instead
* lib/log_format.c (qb_vsnprintf_deserialize): We know that there are
len or more non-NUL bytes in the source string, so it's clearer to
use memcpy.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 20:47:57 +10:00
Angus Salkeld
c56427e19e LOG: accept NULL strings into the blackbox
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 14:16:54 +10:00
Igor Pashev
62e070a720 Test for log facility names 2012-05-09 18:56:08 +10:00
Angus Salkeld
504e000cb8 LOG: add a hostname %H format specifier.
This is useful when logging to file on a cluster.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 17:34:45 +11:00
Angus Salkeld
7eaa3dc09a LOG: add %P (pid) as a format option.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-09 16:03:15 +11:00
Fabio M. Di Nitto
9f5d0aebbb Fix some sparc test failures.
I (Angus) have changed some of Fabio's changes.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-22 13:56:20 +11:00
Angus Salkeld
ef77398738 Fix errors found by api-sanity-autotest
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-25 17:16:19 +11:00
Angus Salkeld
ca4fe98136 Lindent formatting changes.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:49:14 +11:00
Andrew Beekhof
68b33d7243 Log: Support right-aligned text in format strings
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-18 09:51:19 +11:00
Yunkai Zhang
8a673559e7 Fixed segment fault bug when use logging API at i386 platform
This bug cause by qb_vsprintf_serialize function. It parse "%llx" format
as _long_ other than _long long_.

At x86_64 platform, both sizeof(long) and sizeof(long long) is 8, this
issue would not be triggered, so we could only catch it at i386.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-18 09:33:24 +11:00
Angus Salkeld
0a50fe57e7 LOG: add facility conversion functions
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 09:47:49 +10:00
Angus Salkeld
e1be00130c LOG: fix ansi build
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 14:11:43 +10:00
Angus Salkeld
1591075873 LOG: serialize the va_list, don't snprintf
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 10:29:48 +10:00
Angus Salkeld
98493d9ae8 Change Lindent options to break the procedure type.
so change:
int foo(void)

to

int
foo(void)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 14:19:14 +10:00
Angus Salkeld
048edde19c LOG: add custom targets
This is partly to make the tests more robusts and
to add some more flexibility to the logging.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-23 20:28:18 +10:00
Angus Salkeld
373709e082 LOG: strip the last "\n" from incomming messages
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-13 10:06:45 +10:00
Angus Salkeld
a8eef8a9d6 LOG: check prioritynames[] bounds
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:54:13 +10:00
Angus Salkeld
5af627b40f LOG: fix formatting test (fails in make distcheck)
This fails as the BUILDING_IN_PLACE patch was left out.
Now re-added, make distcheck passes.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:31:07 +10:00
Angus Salkeld
568befd3f1 LOG: add LOG_TRACE
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-12 22:21:57 +10:00
Angus Salkeld
57fee1b0e3 LOG: make prioritynames[] static
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 21:30:34 +10:00
Angus Salkeld
c97d98f7f7 LOG: general cleanup (indentation, NULL checks, etc...) 2011-04-01 15:32:44 +11:00
Angus Salkeld
631f56b8d6 LOG: move formatting code into new file
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-01 15:05:16 +11:00