mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
now always define nc_set_log_level unless user disables
This commit is contained in:
parent
605a5bfb0b
commit
27a74dee54
11
configure.ac
11
configure.ac
@ -308,6 +308,17 @@ AC_ARG_ENABLE([logging],
|
||||
test "x$enable_logging" = xyes || enable_logging=no
|
||||
AC_MSG_RESULT([$enable_logging])
|
||||
|
||||
# Does the user want to turn off nc_set_log_level() function? (It will
|
||||
# always be defined if --enable-logging is used.)
|
||||
AC_MSG_CHECKING([whether nc_set_log_level() function is included (will do nothing unless enable-logging is also used)])
|
||||
AC_ARG_ENABLE([set_log_level_func], [AS_HELP_STRING([--disable-set-log-level-func],
|
||||
[disable the nc_set_log_level function])])
|
||||
test "x$enable_set_log_level_func" = xno -a "x$enable_logging" = xno || enable_set_log_level_func=yes
|
||||
if test "x$enable_set_log_level_func" = xyes; then
|
||||
AC_DEFINE([USE_SET_LOG_LEVEL], 1, [If true, define nc_set_log_level.])
|
||||
fi
|
||||
AC_MSG_RESULT($enable_set_log_level_func)
|
||||
|
||||
## Capture the state of the --enable-dap flag => enable dap2+dap4
|
||||
AC_MSG_CHECKING([whether DAP client(s) are to be built])
|
||||
AC_ARG_ENABLE([dap],
|
||||
|
@ -51,8 +51,6 @@ void nc_log_hdf5(void);
|
||||
|
||||
#define BAIL_QUIET BAIL
|
||||
|
||||
#define nc_set_log_level(e)
|
||||
|
||||
#endif /* LOGGING */
|
||||
|
||||
/* To log an error message (if 'LOGGING' is defined), set retval, and jump to exit. */
|
||||
|
@ -1726,8 +1726,6 @@ EXTERNL int
|
||||
nc_get_var_ubyte(int ncid, int varid, unsigned char *ip);
|
||||
/* End Deprecated */
|
||||
|
||||
#ifdef LOGGING
|
||||
|
||||
/* Set the log level. 0 shows only errors, 1 only major messages,
|
||||
* etc., to 5, which shows way too much information. */
|
||||
EXTERNL int
|
||||
@ -1737,12 +1735,6 @@ nc_set_log_level(int new_level);
|
||||
nc_log_level(NC_TURN_OFF_LOGGING) */
|
||||
#define NC_TURN_OFF_LOGGING (-1)
|
||||
|
||||
#else /* not LOGGING */
|
||||
|
||||
#define nc_set_log_level(e) /**< Get rid of these calls. */
|
||||
|
||||
#endif /* LOGGING */
|
||||
|
||||
/* Show the netCDF library's in-memory metadata for a file. */
|
||||
EXTERNL int
|
||||
nc_show_metadata(int ncid);
|
||||
|
@ -1,16 +1,15 @@
|
||||
/*
|
||||
|
||||
This file is part of netcdf-4, a netCDF-like interface for HDF5, or a
|
||||
HDF5 backend for netCDF, depending on your point of view.
|
||||
|
||||
This file contains functions relating to logging errors. Also it
|
||||
contains the functions nc_malloc, nc_calloc, and nc_free.
|
||||
|
||||
Copyright 2003, University Corporation for Atmospheric Research. See
|
||||
netcdf-4/docs/COPYRIGHT file for copying and redistribution
|
||||
conditions.
|
||||
|
||||
$Id: error4.c,v 1.4 2010/06/01 17:48:55 ed Exp $
|
||||
/* Copyright 2003-2018, University Corporation for Atmospheric
|
||||
Research. See netcdf-4/docs/COPYRIGHT file for copying and
|
||||
redistribution conditions. */
|
||||
/**
|
||||
* @file @internal This file is part of netcdf-4, a netCDF-like
|
||||
* interface for HDF5, or a HDF5 backend for netCDF, depending on your
|
||||
* point of view.
|
||||
*
|
||||
* This file contains functions relating to logging errors. Also it
|
||||
* contains the functions nc_malloc, nc_calloc, and nc_free.
|
||||
*
|
||||
* @author Ed Hartnett
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -2011,13 +2011,14 @@ nc4_normalize_name(const char *name, char *norm_name)
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/* Print out a bunch of info to stderr about the metadata for
|
||||
debugging purposes. */
|
||||
#ifdef LOGGING
|
||||
#ifdef USE_SET_LOG_LEVEL
|
||||
|
||||
/**
|
||||
* Use this to set the global log level. Set it to NC_TURN_OFF_LOGGING
|
||||
* (-1) to turn off all logging. Set it to 0 to show only errors, and
|
||||
* to higher numbers to show more and more logging details.
|
||||
* @internal Use this to set the global log level. Set it to
|
||||
* NC_TURN_OFF_LOGGING (-1) to turn off all logging. Set it to 0 to
|
||||
* show only errors, and to higher numbers to show more and more
|
||||
* logging details. If logging is not enabled with --enable-logging at
|
||||
* configure when building netCDF, this function will do nothing.
|
||||
*
|
||||
* @param new_level The new logging level.
|
||||
*
|
||||
@ -2027,6 +2028,7 @@ nc4_normalize_name(const char *name, char *norm_name)
|
||||
int
|
||||
nc_set_log_level(int new_level)
|
||||
{
|
||||
#ifdef LOGGING
|
||||
if(!nc4_hdf5_initialized)
|
||||
nc4_hdf5_initialize();
|
||||
|
||||
@ -2051,9 +2053,12 @@ nc_set_log_level(int new_level)
|
||||
/* Now remember the new level. */
|
||||
nc_log_level = new_level;
|
||||
LOG((4, "log_level changed to %d", nc_log_level));
|
||||
#endif /*LOGGING */
|
||||
return 0;
|
||||
}
|
||||
#endif /* USE_SET_LOG_LEVEL */
|
||||
|
||||
#ifdef LOGGING
|
||||
#define MAX_NESTS 10
|
||||
/**
|
||||
* @internal Recursively print the metadata of a group.
|
||||
|
Loading…
Reference in New Issue
Block a user