Commit Graph

175 Commits

Author SHA1 Message Date
Angus Salkeld
864e5c9c32 LOG: add stdarg to qblog.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-10-23 13:36:07 +11:00
Angus Salkeld
dc3a061e98 MAP: pass user_data to the callback correctly
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-16 13:31:31 +10:00
Angus Salkeld
d6e352fda5 MAP: add a more generic notification system
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-15 21:14:49 +10:00
Angus Salkeld
4780308fea MAP: add prefix iteration for the trie
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 20:54:39 +10:00
Angus Salkeld
61268e3cb9 MAP: improve the storage in the trie
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-13 17:09:20 +10:00
Angus Salkeld
57212c0e94 MAP: add a trie implementation
http://en.wikipedia.org/wiki/Trie

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-12 23:01:15 +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
46a8903826 LOG: fix QB_LOG_INIT_DATA
this is weird, but now it actually works

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-09 12:07:57 +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
86f004d1ec map: add iterator that does't use a callback
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 12:05:15 +10:00
Angus Salkeld
4b594b522d MAP: change the keys from void* to char*
I think this is the most common usage and greatly
simplifies the api.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-09-07 09:47:49 +10: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
2b7edd508d defs: better define va_copy
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-26 09:39:26 +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
94767b18b8 Initial map using either a skiplist or a hashtable
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 14:11:43 +10:00
Angus Salkeld
8f954cd115 Add a stop watch
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-22 13:28:15 +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
e3b167819c atomic: fix qb_atomic_pointer macros
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-19 10:21:02 +10:00
Angus Salkeld
ea8dfea7a0 LOG: allow the thread priority to be set.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-08-07 22:37:42 +10:00
Angus Salkeld
bb1140fbd9 Add a qb_strerror_r wrapper.
This is to make the calling code more portable

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-07-14 10:41:46 +10:00
Angus Salkeld
638f75dbc5 LOG: add string.h to qblog.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-07-13 10:31:17 +10:00
Angus Salkeld
f4e2705e95 LOG: use strerror_r instead of strerror in qb_perror()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-27 15:57:51 +10:00
Angus Salkeld
001b4a078c LOOP: make the return more consistent in qb_loop_timer_expire_time_get()
If there is any error return 0
 (meaning the timer is or has expired)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 13:13:34 +10:00
Виноградов Василий
c3688ab19c Provide some helpful macros for iterating over lists.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-27 20:43:51 +10:00
Angus Salkeld
7ffd10326a Correct the declarations of some inlines
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-26 10:42:15 +10:00
Angus Salkeld
ebe8cd7008 Add support for ansi inline and typeof
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-26 10:41:06 +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
943b1c646b fix the FIXME's Jim pointed out
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-18 11:11:14 +10:00
Angus Salkeld
acf8c0e94f LOG: make the "entering" and "leaving" capital
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-13 10:05:12 +10:00
Angus Salkeld
2a83aa8dfe LOG: add an enter and leave trace function
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-06 10:54:20 +10:00
Angus Salkeld
46102fe43a LOG: include needed stdio.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-18 22:54:13 +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
ea2d5d4058 Add qbconfig.h to the list of headers to be installed.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 22:23:01 +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
4de5ff927f ARRAY: add getter's to retrieve number of bins and elms/bin
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 09:55:57 +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
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
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
Angus Salkeld
9aa50b2ece LOG: fix shared library callsites
This finds all the callsites in shared libraries
(using dl_iterate_phdr()) at the time qb_log_init()
is called.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>

Conflicts:

	lib/log.c
2011-04-06 22:09:46 +10:00
Angus Salkeld
9b18614473 LOG: add a callsite_dump() function to see what callsite are avaliable.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 22:06:01 +10:00
Angus Salkeld
aefae42937 LOG: support dynamically loaded modules
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-06 21:41:13 +10:00
Angus Salkeld
51a1153ecb Add required include to qbloop.h
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-04 11:09:16 +10:00
Angus Salkeld
b81d75fab5 LOG: make the documentation more meaningful
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-01 22:42:43 +11:00
Angus Salkeld
7f0d983f49 LOG: add a qb_log_fini() to cleanup
This replaces qb_log_thread_stop() but also release shared mem

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-01 14:50:51 +11:00
Angus Salkeld
e390613036 LOG: fix mapping from priority to name
Remove qb_log_priority_name_get() as we have the
formatting.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:38:08 +11:00
Angus Salkeld
191b71a8b7 LOG: add a new "tags" field
this is a tags that is used by the caller to:
- define the message as an external message (needs free'ing)
- define a feature or susbsytem that can be printed in the log message.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:37:44 +11:00
Angus Salkeld
9d159ab87f LOG: change "tags" field to "targets"
This is it's new meaning, so makes things clearer

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-31 21:33:37 +11:00
Angus Salkeld
34ee74db55 LOG: add a format option to each target.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-03-30 23:06:41 +11:00