source: XIOS/dev/dev_olga/src/extern/src_netcdf4/nc_logging.h @ 1022

Last change on this file since 1022 was 1022, checked in by mhnguyen, 7 years ago
File size: 1.3 KB
Line 
1/* Copyright 2010, University Corporation for Atmospheric Research. See
2   COPYRIGHT file for copying and redistribution conditions.
3
4   This file is part of netcdf-4, a netCDF-like interface for HDF5, or
5   a HDF5 backend for netCDF, depending on your point of view.
6
7   This file contains macros and prototyes relating to logging.
8
9   $Id: nc_logging.h,v 1.1 2010/06/01 15:34:49 ed Exp $
10*/
11
12#ifndef _NCLOGGING_
13#define _NCLOGGING_
14
15#include <stdlib.h>
16#include <assert.h>
17
18#ifdef LOGGING
19
20/* To log something... */
21void nc_log(int severity, const char *fmt, ...);
22void nc_log_hdf5(void);
23
24#define LOG(e) nc_log e
25
26/* To log based on error code, and set retval. */
27#define BAIL2(e) do { \
28retval = e; \
29LOG((0, "file %s, line %d.\n%s", __FILE__, __LINE__, nc_strerror(e))); \
30nc_log_hdf5(); \
31} while (0)
32
33/* To log an error message, set retval, and jump to exit. */
34#define BAIL(e) do { \
35BAIL2(e); \
36goto exit; \
37} while (0)
38
39/* To set retval and jump to exit, without logging error message. */
40#define BAIL_QUIET(e) do { \
41retval = e; \
42goto exit; \
43} while (0)
44
45#else
46
47/* These definitions will be used unless LOGGING is defined. */
48#define LOG(e)
49#define BAIL(e) do { \
50retval = e; \
51goto exit; \
52} while (0)
53#define BAIL_QUIET BAIL
54#define BAIL2(e) do { \
55goto exit; \
56} while (0)
57#define nc_set_log_level(e)
58#endif
59
60#endif /* _NCLOGGING_ */
61
62
Note: See TracBrowser for help on using the repository browser.