Takeshi MIZUTA
96e504f305
Unify the list processing with qb_list function
2013-01-09 02:04:20 +09: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
a623af9696
LOG: don't break on empty callsites, just ignore them
...
else we might miss some callsites.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:34:23 +11:00
David Vossel
d5b762e441
LOG: Invoke custom log filter function if tag changes
2012-07-19 17:18:46 -05:00
Angus Salkeld
b9f8ec34df
LOG: fix threaded logging.
...
This has been broken for a year - yikes!
Thanks to Voznesensky Vladimir for spotting it.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-14 11:01:52 +10:00
Angus Salkeld
b52f2e37b3
LOG: make it possible to fsync() on each file log.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-06-05 12:07:35 +10:00
Angus Salkeld
072e224331
LOG: protect close and reload from calling log
...
Logging during these operations is temporarly disabled.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-24 13:06:51 +10:00
Angus Salkeld
d327ef7928
LOG: expose the mechanism to get a dynamic callsite.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-05 16:11:30 +11:00
Angus Salkeld
4356fbf577
UTIL: if possible use COARSE resolution clocks - they are much faster.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-24 11:25:55 +11:00
Angus Salkeld
4dbfebbdbc
LOG: add stdout target
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-20 14:46:43 +11:00
Angus Salkeld
b298e01abc
LOG: remove debug printf's
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 17:38:59 +11: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
ff0d89721f
LOG: Add qb_log_filter_fn_set()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-15 15:40:58 +11:00
Angus Salkeld
943e6b301d
Remove dead code
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
7a6382f0b6
Use safer versions of string functions (strcpy -> strlcpy)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-08 22:00:49 +11:00
Angus Salkeld
b711f73ce7
LOG: add %N (log name) as a format option
...
This will log the name passed into qb_log_init()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-09 16:02:53 +11:00
Angus Salkeld
ab3dc60f7f
Merge some portability changes from the mingw branch
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-21 14:23:43 +11:00
Andrew Beekhof
61d166abbc
Support compilation on Mac OSX
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-19 22:16:30 +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
177e54cb14
LOG: improve the removal of filters
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 21:29:04 +11:00
Angus Salkeld
fdf418abf5
LOG: clean up mem better when qb_log_fini is called
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 21:28:14 +11:00
Angus Salkeld
ca4fe98136
Lindent formatting changes.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:49:14 +11:00
Angus Salkeld
b519f4f37d
LOG: change assert into an early return
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:42:26 +11:00
Angus Salkeld
0171399274
Remove unnecessary checks before free()
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-08 10:41:32 +11:00
Angus Salkeld
596bcf3dde
LOG: fix filter input check
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 13:36:07 +11:00
Angus Salkeld
ae86140250
LOG: only range check "t" when filtering else tags are not applied.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-21 14:51:22 +11:00
Angus Salkeld
5944229b60
LOG: allow large priorities
...
They will be printed as trace, it's mainly to make
filtering more flexible
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-09 16:20:54 +10:00
Angus Salkeld
0a1c464514
LOG: add qb_log_filter_ctl2() so we can filter a range of priorities
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-09 14:09:02 +10:00
Angus Salkeld
f5fcf2a30b
LOG: add a way of getting the target state
...
This is so we can do the following:
for (t = 0; t < QB_LOG_TARGET_MAX; t++) {
if (qb_log_ctl(t, QB_LOG_CONF_STATE_GET, 0) == QB_LOG_STATE_ENABLED) {
// bla bla
}
}
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-08 16:40:02 +10:00
Angus Salkeld
be8248bd50
LOG: support comma seperated lists of file and function filters
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-08 13:24:18 +10:00
Angus Salkeld
9df0c32398
LOG: fix the default syslog filter
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-01 13:51:06 +10:00
Angus Salkeld
2b7edd508d
defs: better define va_copy
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-26 09:39:26 +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
523922b202
LOG: change active list into array access
...
just keep track of the max used targets
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-19 12:44:37 +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
0cdf5b4ad8
LOG: add a rwlock to protect the lists.
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-19 13:58:11 +10:00
Angus Salkeld
943b1c646b
fix the FIXME's Jim pointed out
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-18 11:11:14 +10:00
Jim Meyering
9c467cb150
add FIXME comments for other NULL-deref-upon-OOM problems
...
* lib/ipc_us.c (handle_new_connection):
* lib/loop_job.c (qb_loop_jobs_create):
* lib/loop_poll.c (qb_loop_poll_create):
* lib/loop_timerlist.c (qb_loop_timer_create):
* lib/ringbuffer.c (qb_rb_open):
* lib/ipcc.c (qb_ipcc_connect): Likewise.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-17 21:32:29 +10:00
Angus Salkeld
6f73dd2993
LOG: make all priorities uint8_t
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:54:13 +10:00
Angus Salkeld
88107c1bd7
LOG: fix logging to file
...
qb_log_file_open() left the target in an UNUSED state.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-15 15:11:24 +10:00
Angus Salkeld
d8b1c2564c
Compile on FreeBSD
...
Also re-run autoscan.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-15 14:01:36 +10:00
Angus Salkeld
7d89455bec
LOG: refactor the filter code a bit.
...
Reuse code a bit better.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 22:23:51 +10:00
Angus Salkeld
c2f72d4068
LOG: add some basic tests & fixes
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:05:46 +10:00
Angus Salkeld
b7e83fd3b2
LOG: add dynamic callsites (for platforms that don't support __attribute__(section)
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 16:05:38 +10:00
Angus Salkeld
78541f5198
LOG: add the ability to adjust the priority sent to syslog()
...
If you have:
qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD,
QB_LOG_FILTER_FILE, "hack.c", LOG_DEBUG);
these logs will not make there way to /var/log/messags
without reconfiguring syslog.
So to help on the fly debugging do the following:
qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_PRIORITY_BUMP,
LOG_INFO - LOG_DEBUG);
Now all messages that have the QB_LOG_SYSLOG target set
will have their priority bumped before going to syslog().
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-12 22:20:50 +10:00
Angus Salkeld
58697dbcc6
LOG: change the target type from uint32_t to int32_t.
...
This is so that you won't get warnings from mixing integer types.
I have updated the input checks in log.c to check for invalid
targets.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-09 23:11:44 +10:00
Angus Salkeld
bee9477d67
LOG: fix splint warning
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:43:49 +10:00
Angus Salkeld
249546a9e7
LOG: teach filter_ctl() to write tags
...
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:27:53 +10:00
Angus Salkeld
b5d27ad250
LOG: remove the tags arument from qb_log() and add qb_logt() which has the tags argument.
...
I think in most cases tags will not be used and it will
just be a pain inserting ", 0". But if someone wants to use
tags like this then they still can via qb_logt()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:27:41 +10:00