Browse Source

lite: disable debug logging

William Pitcock 9 months ago
parent
commit
2d0c1f5cb7
3 changed files with 12 additions and 0 deletions
  1. 4
    0
      cli/main.c
  2. 4
    0
      libpkgconf/client.c
  3. 4
    0
      libpkgconf/libpkgconf.h

+ 4
- 0
cli/main.c View File

@@ -876,11 +876,13 @@ main(int argc, char *argv[])
876 876
 		{ NULL, 0, NULL, 0 }
877 877
 	};
878 878
 
879
+#ifndef PKGCONF_LITE
879 880
 	if (getenv("PKG_CONFIG_EARLY_TRACE"))
880 881
 	{
881 882
 		error_msgout = stderr;
882 883
 		pkgconf_client_set_trace_handler(&pkg_client, error_handler, NULL);
883 884
 	}
885
+#endif
884 886
 
885 887
 #ifndef PKGCONF_LITE
886 888
 	personality = deduce_personality(argv);
@@ -981,8 +983,10 @@ main(int argc, char *argv[])
981 983
 	if ((want_flags & PKG_VALIDATE) == PKG_VALIDATE || (want_flags & PKG_DEBUG) == PKG_DEBUG)
982 984
 		pkgconf_client_set_warn_handler(&pkg_client, error_handler, NULL);
983 985
 
986
+#ifndef PKGCONF_LITE
984 987
 	if ((want_flags & PKG_DEBUG) == PKG_DEBUG)
985 988
 		pkgconf_client_set_trace_handler(&pkg_client, error_handler, NULL);
989
+#endif
986 990
 
987 991
 	if ((want_flags & PKG_ABOUT) == PKG_ABOUT)
988 992
 	{

+ 4
- 0
libpkgconf/client.c View File

@@ -99,8 +99,10 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error
99 99
 	client->error_handler = error_handler;
100 100
 	client->auditf = NULL;
101 101
 
102
+#ifndef PKGCONF_LITE
102 103
 	if (client->trace_handler == NULL)
103 104
 		pkgconf_client_set_trace_handler(client, NULL, NULL);
105
+#endif
104 106
 
105 107
 	pkgconf_client_set_error_handler(client, error_handler, error_handler_data);
106 108
 	pkgconf_client_set_warn_handler(client, NULL, NULL);
@@ -567,6 +569,7 @@ pkgconf_client_set_error_handler(pkgconf_client_t *client, pkgconf_error_handler
567 569
 	}
568 570
 }
569 571
 
572
+#ifndef PKGCONF_LITE
570 573
 /*
571 574
  * !doc
572 575
  *
@@ -607,3 +610,4 @@ pkgconf_client_set_trace_handler(pkgconf_client_t *client, pkgconf_error_handler
607 610
 		PKGCONF_TRACE(client, "installing default trace handler");
608 611
 	}
609 612
 }
613
+#endif

+ 4
- 0
libpkgconf/libpkgconf.h View File

@@ -278,6 +278,7 @@ PKGCONF_API bool pkgconf_warn(const pkgconf_client_t *client, const char *format
278 278
 PKGCONF_API bool pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t lineno, const char *funcname, const char *format, ...) PRINTFLIKE(5, 6);
279 279
 PKGCONF_API bool pkgconf_default_error_handler(const char *msg, const pkgconf_client_t *client, const void *data);
280 280
 
281
+#ifndef PKGCONF_LITE
281 282
 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
282 283
 #define PKGCONF_TRACE(client, ...) do { \
283 284
 		pkgconf_trace(client, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__); \
@@ -287,6 +288,9 @@ PKGCONF_API bool pkgconf_default_error_handler(const char *msg, const pkgconf_cl
287 288
 		pkgconf_trace(client, __FILE__, __LINE__, __func__, __VA_ARGS__); \
288 289
 	} while (0);
289 290
 #endif
291
+#else
292
+#define PKGCONF_TRACE(client, ...)
293
+#endif
290 294
 
291 295
 PKGCONF_API pkgconf_pkg_t *pkgconf_pkg_ref(pkgconf_client_t *client, pkgconf_pkg_t *pkg);
292 296
 PKGCONF_API void pkgconf_pkg_unref(pkgconf_client_t *client, pkgconf_pkg_t *pkg);