From cbeb1227a16f62975115e1e9216ccf2724bfd046 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 4 Sep 2000 08:58:15 +0000 Subject: [PATCH] Added prefix yaz_ for most logging utility functions. --- CHANGELOG | 4 ++++ client/client.c | 7 +++++-- include/yaz/log.h | 19 +++++++++++-------- server/seshigh.c | 7 +++++-- server/statserv.c | 13 ++++++++----- util/log.c | 27 +++++++++++++++------------ ztest/ztest.c | 9 ++++++--- 7 files changed, 54 insertions(+), 32 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c1e9025..b021558 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ Possible compatibility problems with earlier versions marked with '*'. +* Added prefix "yaz_" for the functions log_init.., log_file.. and +log_mask_str. This was done to avoid name conflicts with other +libraries (say other PHP extensions). + Added raw OID member for preferred record syntax (request_format_raw) and returned record syntax (output_format_raw) for backend fetch method. diff --git a/client/client.c b/client/client.c index 03fbd7d..7f007ab 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.103 2000-08-10 08:41:26 adam + * Revision 1.104 2000-09-04 08:58:15 adam + * Added prefix yaz_ for most logging utility functions. + * + * Revision 1.103 2000/08/10 08:41:26 adam * Fixes for ILL. * * Revision 1.102 2000/05/18 11:57:04 adam @@ -2513,7 +2516,7 @@ int main(int argc, char **argv) apdu_file=fopen(arg, "a"); break; case 'v': - log_init (log_mask_str(arg), "", NULL); + yaz_log_init (yaz_log_mask_str(arg), "", NULL); break; default: fprintf (stderr, "Usage: %s [-m ] [ -a ] " diff --git a/include/yaz/log.h b/include/yaz/log.h index 2bdd4c8..0c3bcf9 100644 --- a/include/yaz/log.h +++ b/include/yaz/log.h @@ -24,7 +24,10 @@ * OF THIS SOFTWARE. * * $Log: log.h,v $ - * Revision 1.3 2000-06-09 13:51:01 ian + * Revision 1.4 2000-09-04 08:58:15 adam + * Added prefix yaz_ for most logging utility functions. + * + * Revision 1.3 2000/06/09 13:51:01 ian * Added LOG_APP for logging application (Rather than code) events that might * be useful when creating usage reports. * @@ -117,19 +120,19 @@ YAZ_BEGIN_CDECL #define logf yaz_log -YAZ_EXPORT void log_init(int level, const char *prefix, const char *name); -YAZ_EXPORT void log_init_file (const char *fname); -YAZ_EXPORT void log_init_level (int level); -YAZ_EXPORT void log_init_prefix (const char *prefix); +YAZ_EXPORT void yaz_log_init(int level, const char *prefix, const char *name); +YAZ_EXPORT void yaz_log_init_file (const char *fname); +YAZ_EXPORT void yaz_log_init_level (int level); +YAZ_EXPORT void yaz_log_init_prefix (const char *prefix); YAZ_EXPORT void yaz_log(int level, const char *fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif ; -YAZ_EXPORT int log_mask_str (const char *str); -YAZ_EXPORT int log_mask_str_x (const char *str, int level); -YAZ_EXPORT FILE *log_file(void); +YAZ_EXPORT int yaz_log_mask_str (const char *str); +YAZ_EXPORT int yaz_log_mask_str_x (const char *str, int level); +YAZ_EXPORT FILE *yaz_log_file(void); YAZ_EXPORT void log_event_start (void (*func)(int level, const char *msg, void *info), void *info); diff --git a/server/seshigh.c b/server/seshigh.c index 0bd8ba5..11815cf 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -3,7 +3,10 @@ * See the file LICENSE for details. * * $Log: seshigh.c,v $ - * Revision 1.107 2000-08-31 10:20:12 adam + * Revision 1.108 2000-09-04 08:58:15 adam + * Added prefix yaz_ for most logging utility functions. + * + * Revision 1.107 2000/08/31 10:20:12 adam * Added member request_format and output_format for backend fetch method. * * Revision 1.106 2000/08/31 09:51:25 adam @@ -608,7 +611,7 @@ void ir_session(IOCHAN h, int event) odr_errmsg(odr_geterror(assoc->decode)), odr_offset(assoc->decode)); yaz_log(LOG_LOG, "PDU dump:"); - odr_dumpBER(log_file(), assoc->input_buffer, res); + odr_dumpBER(yaz_log_file(), assoc->input_buffer, res); do_close(assoc, Z_Close_protocolError, "Malformed package"); return; } diff --git a/server/statserv.c b/server/statserv.c index c5228f5..9e3d0ef 100644 --- a/server/statserv.c +++ b/server/statserv.c @@ -7,7 +7,10 @@ * Chas Woodfield, Fretwell Downing Informatics. * * $Log: statserv.c,v $ - * Revision 1.64 2000-04-05 07:39:55 adam + * Revision 1.65 2000-09-04 08:58:15 adam + * Added prefix yaz_ for most logging utility functions. + * + * Revision 1.64 2000/04/05 07:39:55 adam * Added shared library support (libtool). * * Revision 1.63 2000/03/20 19:06:25 adam @@ -609,7 +612,7 @@ static void listener(IOCHAN h, int event) } } sprintf(nbuf, "%s(%d)", me, getpid()); - log_init(control_block.loglevel, nbuf, 0); + yaz_log_init(control_block.loglevel, nbuf, 0); } else /* parent */ { @@ -971,11 +974,11 @@ int check_options(int argc, char **argv) break; case 'l': strcpy(control_block.logfile, arg ? arg : ""); - log_init(control_block.loglevel, me, control_block.logfile); + yaz_log_init(control_block.loglevel, me, control_block.logfile); break; case 'v': - control_block.loglevel = log_mask_str(arg); - log_init(control_block.loglevel, me, control_block.logfile); + control_block.loglevel = yaz_log_mask_str(arg); + yaz_log_init(control_block.loglevel, me, control_block.logfile); break; case 'a': strcpy(control_block.apdufile, arg ? arg : ""); diff --git a/util/log.c b/util/log.c index 53b85d3..e4f9ac1 100644 --- a/util/log.c +++ b/util/log.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: log.c,v $ - * Revision 1.23 2000-03-14 09:06:11 adam + * Revision 1.24 2000-09-04 08:58:15 adam + * Added prefix yaz_ for most logging utility functions. + * + * Revision 1.23 2000/03/14 09:06:11 adam * Added POSIX threads support for frontend server. * * Revision 1.22 2000/02/29 13:44:55 adam @@ -150,14 +153,14 @@ static struct { { 0, NULL } }; -FILE *log_file(void) +FILE *yaz_log_file(void) { if (!l_file) l_file = stderr; return l_file; } -void log_init_file (const char *fname) +void yaz_log_init_file (const char *fname) { FILE *new_file; if (!l_file) @@ -174,22 +177,22 @@ void log_init_file (const char *fname) l_file = new_file; } -void log_init_level (int level) +void yaz_log_init_level (int level) { l_level = level; } -void log_init_prefix (const char *prefix) +void yaz_log_init_prefix (const char *prefix) { if (prefix && *prefix) sprintf(l_prefix, "%.512s", prefix); } -void log_init(int level, const char *prefix, const char *fname) +void yaz_log_init(int level, const char *prefix, const char *fname) { - log_init_level (level); - log_init_prefix (prefix); - log_init_file (fname); + yaz_log_init_level (level); + yaz_log_init_prefix (prefix); + yaz_log_init_file (fname); } static void (*start_hook_func)(int, const char *, void *) = NULL; @@ -250,12 +253,12 @@ void yaz_log(int level, const char *fmt, ...) (*end_hook_func)(o_level, buf, end_hook_info); } -int log_mask_str (const char *str) +int yaz_log_mask_str (const char *str) { - return log_mask_str_x (str, LOG_DEFAULT_LEVEL); + return yaz_log_mask_str_x (str, LOG_DEFAULT_LEVEL); } -int log_mask_str_x (const char *str, int level) +int yaz_log_mask_str_x (const char *str, int level) { const char *p; int i; diff --git a/ztest/ztest.c b/ztest/ztest.c index 3279ae2..ba7dc20 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -6,7 +6,10 @@ * Chas Woodfield, Fretwell Downing Datasystems. * * $Log: ztest.c,v $ - * Revision 1.33 2000-08-10 08:41:26 adam + * Revision 1.34 2000-09-04 08:58:15 adam + * Added prefix yaz_ for most logging utility functions. + * + * Revision 1.33 2000/08/10 08:41:26 adam * Fixes for ILL. * * Revision 1.32 2000/04/05 07:39:55 adam @@ -219,7 +222,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) odr_offset(rr->decode)); #if 0 yaz_log(LOG_LOG, "PDU dump:"); - odr_dumpBER(log_file(), + odr_dumpBER(yaz_log_file(), r->u.single_ASN1_type->buf, r->u.single_ASN1_type->len); #endif @@ -247,7 +250,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) odr_errmsg(odr_geterror(rr->decode)), odr_offset(rr->decode)); yaz_log(LOG_LOG, "PDU dump:"); - odr_dumpBER(log_file(), + odr_dumpBER(yaz_log_file(), r->u.single_ASN1_type->buf, r->u.single_ASN1_type->len); } -- 1.7.10.4