summaryrefslogtreecommitdiffstats
path: root/common/logging.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Require libgpg-error 1.29 and remove internal logging functions.Werner Koch2018-06-121-90/+4
| | | | | | | | | | * configure.ac (NEED_GPG_ERROR_VERSION): Set to 1.29 * common/util.h: Remove replacement error codes. * common/logging.h: Remove fallback to internal logging functions. * common/logging.c: Remove. * common/Makefile.am (common_sources): Remove logging.c Signed-off-by: Werner Koch <wk@gnupg.org>
* Merge branch 'STABLE-BRANCH-2-2' into masterWerner Koch2018-01-251-0/+27
|\ | | | | | | Signed-off-by: Werner Koch <wk@gnupg.org>
| * kbx: Simplify by removing custom memory functions.Werner Koch2017-12-221-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * kbx/keybox-util.c (keybox_set_malloc_hooks): Remove. (_keybox_malloc, _keybox_calloc, keybox_realloc) (_keybox_free): Remove. (keybox_file_rename): Remove. Was not used. * sm/gpgsm.c (main): Remove call to keybox_set_malloc_hooks. * kbx/kbxutil.c (main): Ditto. * kbx/keybox-defs.h: Remove all separate includes. Include util.h. remove convenience macros. * common/logging.h (return_if_fail): New. Originally from keybox-defs.h but now using log_debug. (return_null_if_fail): Ditto. (return_val_if_fail): Ditto. (never_reached): Ditto. -- Originally the KBX code was written to allow standalone use. However this required lot of ugliness like separate memory allocators and such. It also precludes the use of some standard functions from common due to their use of the common gnupg malloc functions. Dropping all that makes things easier. Minor disadvantages: the kbx call done for gpg will now use gcry malloc fucntions and not the standard malloc functions. This might be a bit slower but removing them even fixes a possible bug in keybox_tmp_names which is used in gpg and uses gpg's xfree which is actually gcry_free. Signed-off-by: Werner Koch <wk@gnupg.org>
| * Revert: build: Do not define logging.h constants for ...Werner Koch2017-12-081-17/+9
| | | | | | | | | | | | | | | | | | | | --- This reverts commit 2fedf8583bcc493f587c90bc9632d25dfd10bd10. We better solve this on the libgpg-error side. Signed-off-by: Werner Koch <wk@gnupg.org>
| * build: Do not define logging.h constants for libgpg-error dev versions.Werner Koch2017-12-071-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/logging.h [GPGRT_LOG_WITH_PREFIX]: Do not define the log constants. -- logging.h uses constants we plan to use for future versions of libgpg-error. My dev version already has the logging functions and thus I run into a conflict. This patch protects against this and make the GnuPG work with later libgpg-error versions. It was not the best idea to use constants from a planned libgpg-error in the first place. The actual problem are the enums, the macros won't harm. Signed-off-by: Werner Koch <wk@gnupg.org>
* | Adjust for changed macro names in libgpg-error master.Werner Koch2017-12-111-2/+12
| | | | | | | | | | | | | | | | | | | | * common/logging.h (GPGRT_LOGLVL_): New replacement macros for older libgpg-error versions. -- Updates-commit: b56dfdfc1865ceb7c3c025d79996e049faee7fdf Signed-off-by: Werner Koch <wk@gnupg.org>
* | Use the gpgrt log functions if possible.Werner Koch2017-11-271-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/logging.c: Do not build any code if we can use the gpgrt_log functions. (log_logv_with_prefix): Rename to log_logv_prefix and change order of args so that this function matches its printf like counterpart gpgrt_logv_prefix. Change all callers. (log_debug_with_string): Rename to log_debug_string. Change all callers. (log_printhex): Move first arg to end so that this function matches its printf like counterpart gpgrt_log_printhex. Change all callers. * common/logging.h: Divert to gpgrt/libgpg-error if we can use the gpgrt_log functions. (bug_at): Add inline versions if we can use the gpgrt_log functions. * configure.ac (GPGRT_ENABLE_LOG_MACROS): Add to AH_BOTTOM. (mycflags): Add -Wno-format-zero-length. -- This patch enables the use of the log function from libgpgrt (aka libgpg-error). Instead of checking a version number, we enable them depending on macros set by recent gpg-error versions. Eventually the whole divert stuff can be removed. The -Wno-format-zero-length is required because log_printhex can be called with an empty format string. Note that this is fully specified standard C behaviour. Signed-off-by: Werner Koch <wk@gnupg.org>
* | common: Change log_clock to printf style.Werner Koch2017-11-151-1/+1
|/ | | | | | * common/logging.c (log_clock): Use do_logv. Signed-off-by: Werner Koch <wk@gnupg.org>
* Clarify text of LGPLv2+/GPLv2+ licensed files.Werner Koch2017-02-241-2/+2
| | | | --
* common: New function log_logv_with_prefix.Werner Koch2017-02-201-0/+2
| | | | | | | | | * common/logging.c (do_logv): Add arg 'prefmt' and print it. Chnage call callers to pass NULL. (log_logv_with_prefix): New. -- Signed-off-by: Werner Koch <wk@gnupg.org>
* common: New function log_debug_with_string.Werner Koch2017-01-111-0/+2
| | | | | | | | | | | | | | | * common/logging.c (do_logv): Factor some code out to ... (print_prefix): new. (log_logv): Add arg EXTRASTRING and print it. Change all callers to pass NULL for it. (log_debug_with_string): New. Uses EXTRASTRING. -- This function can be used to print a human readable buffer in addition to a log message to the log stream. This function will keep all lines together and prefix them with ">> ". Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Fix fallback code.Justus Winter2017-01-101-1/+1
| | | | | | | | * common/logging.c (_log_assert): Fix the variant for compilers that do not support __FUNCTION__. * common/logging.h (_log_assert): Likewise. Signed-off-by: Justus Winter <justus@g10code.com>
* common: Turn assertions into expressions.Justus Winter2017-01-021-8/+8
| | | | | | | * common/logging.h (log_assert): Turn this into an expression so it can be used in expressions. Signed-off-by: Justus Winter <justus@g10code.com>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* common: Add a default socket name feature.Werner Koch2016-08-291-0/+1
| | | | | | | | | | | | | | | | | * common/logging.c (log_set_socket_dir_cb): New. (socket_dir_cb): New. (set_file_fd): Allow "socket://". (fun_writer): Implement default socket name. * common/init.c (_init_common_subsystems): Register default socket. -- This change allows the use of log-file socket:// in any configuration file. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Improve log_assert.Werner Koch2016-04-291-10/+15
| | | | | | | | | * common/logging.c (bug_at): Do not i18n the string. (_log_assert): New. * common/logging.h (log_assert): Use new function and pass line information. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Add log_assert.Neal H. Walfield2016-02-231-0/+4
| | | | | | | * common/logging.h (log_assert): New macro. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
* common: Include <gpg-error.h>.Neal H. Walfield2015-09-301-0/+1
| | | | | | | | | | * common/logging.h: Include <gpg-error.h>. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>. logging.h uses estream_t and as such should directly include <gpg-error.h>.
* Replace GNUPG_GCC_A_ macros by GPGRT_ATTR_ macros.Werner Koch2015-07-261-9/+10
| | | | | | | | | | | | | * common/util.h: Provide replacement for GPGRT_ATTR_ macros when using libgpg-error < 1.20. * common/mischelp.h: Ditto. * common/types.h: Ditto. -- Given that libgpg-error is a dependency of all GnuPG related libraries it is better to define such macros at only one place instead of having similar macros at a lot of places. For now we need repalcement macros, though.
* common: Remove JNLIB from boiler plate (jnlib merge).Werner Koch2015-04-241-6/+6
| | | | | | | * common/README.jnlib: Remove. -- This is the final part of merging jnlib into gnupg/common.
* common: Rename log and gcc attribute macros (jnlib merge).Werner Koch2015-04-241-22/+22
| | | | | | | | | | | * common/logging.h: Rename JNLIB_LOG_* to GPGRT_LOG_*. * common/mischelp.h: Rename JNLIB_GCC_* to GPGRT_GCC_*. -- JNLIB has no more meaning. Thus we switch to a GPGRT_ prefix in anticipation that some code may eventually be moved to libgpg-error. Signed-off-by: Werner Koch <wk@gnupg.org>
* common: Remove libjnlib-config.h (jnlib merge).Werner Koch2015-04-241-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/libjnlib-config.h: Remove. * common/common-defs.h (getenv) [HAVE_GETENV]: New. From removed header. (getpid) [HAVE_W32CE_SYSTEM]: New. From removed header. * common/argparse.c: Include util.h and common-defs.h. Replace jnlib_ macro names for non-GNUPG builds by x* names. * common/dotlock.c: Ditto. * common/logging.c: Include util.h and common-defs.h. Replace jnlib_ symbol names by x* names. * common/strlist.c: Ditto. * common/utf8conv.c: Ditto. * common/w32-reg.c: Ditto. * common/mischelp.c: Ditto. Also remove _jnlib_free. * common/stringhelp.c: Ditto. (JNLIB_LOG_WITH_PREFIX): Do not depend on this macro. * common/logging.h (JNLIB_LOG_WITH_PREFIX): Do not depend on this macro. -- This is part 1 of the patches to merge the jnlib files into common/. It does not make much sense to keep jnlib/ files separate. They are not often use elsewhere and maintaining the complex marcos stuff is too troublesome for the future. Signed-off-by: Werner Koch <wk@gnupg.org>
* Switch to the libgpg-error provided estream.Werner Koch2014-08-261-1/+0
| | | | | | | | | | * configure.ac (NEED_GPG_ERROR_VERSION): Reguire 1.14. (GPGRT_ENABLE_ES_MACROS): Define. (estream_INIT): Remove. * m4/estream.m4: Remove. * common/estream-printf.c, common/estream-printf.h: Remove. * common/estream.c, common/estream.h: Remove. * common/init.c (_init_common_subsystems): Call gpgrt initialization.
* w32: Add code to support a portable use of GnuPG.Werner Koch2013-08-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/homedir.c (w32_bin_is_bin, w32_portable_app) [W32]: New. (check_portable_app) [W32]: New. (standard_homedir, default_homedir) [W32]: Support the portable flag. (w32_rootdir, w32_commondir) [W32]: Ditto. (gnupg_bindir, gnupg_cachedir, dirmngr_socket_name) [W32]: Ditto. * common/logging.h (JNLIB_LOG_NO_REGISTRY): New. * common/logging.c (no_registry): New variable. (log_set_prefix, log_get_prefix): Set/get that variable. (do_logv): Do not check the registry if that variable is set. -- Beware: This code has not been tested because it is not yet possible to build GnuPG 2.1 for Windows. However, the code will be the base for an implementation in 2.0. A portable use of GnuPG under Windows means that GnuPG uses a home directory depending on the location of the actual binary. No registry variables are considered. The portable mode is enabled if in the installation directory of the the binary "gpgconf.exe" and a file "gpgconf.ctl" are found. The latter file is empty or consists only of empty or '#' comment lines. Signed-off-by: Werner Koch <wk@gnupg.org>
* New function log_clock.Werner Koch2013-01-071-0/+2
| | | | | | | | | | | * common/logging.c (log_clock): New. * g10/gpg.c (set_debug): Print clock debug flag. * g10/options.h (DBG_CLOCK_VALUE, DBG_CLOCK): New. -- To actually use log_clock you need to enable the code in logginc.c:log_check() and link against librt. --debug 4096 may then be used to enable it at runtime.
* Change JNLIB license to LGPLv3+ or GPLv2+.Werner Koch2011-09-301-7/+18
| | | | This is to allow the use of this code with code under GPLv2(only).
* Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch2011-02-041-5/+0
| | | | | | | | We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
* Re-implemented GPG's --passwd command and improved it.Werner Koch2010-10-261-0/+1
|
* Fix regression in logging.Werner Koch2010-08-181-0/+1
| | | | | | Add a registry key to enable catch-all remote debugging for W32. Replace more stdio stuff by estream.
* Merged Dirmngr with GnuPG.Werner Koch2010-06-091-1/+1
| | | | | A few code changes to support dirmngr.
* Finished the bulk of changes to use estream in most places instead ofWerner Koch2010-03-151-0/+1
| | | | | stdio.
* Use a custom log handler for libassuan.Werner Koch2010-03-111-0/+1
|
* Change logging to use estream. The makes logging to a socket alsoWerner Koch2010-03-101-2/+4
| | | | | | work on Solaris etc. Further changes required.. This is just a first step.
* Merged jnlib into common.Werner Koch2010-03-101-0/+88