Last change
on this file since 2661 was
409,
checked in by ymipsl, 12 years ago
|
Add improved nectdf internal library src
YM
|
-
Property svn:eol-style set to
native
|
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... */ |
---|
21 | void nc_log(int severity, const char *fmt, ...); |
---|
22 | void 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 { \ |
---|
28 | retval = e; \ |
---|
29 | LOG((0, "file %s, line %d.\n%s", __FILE__, __LINE__, nc_strerror(e))); \ |
---|
30 | nc_log_hdf5(); \ |
---|
31 | } while (0) |
---|
32 | |
---|
33 | /* To log an error message, set retval, and jump to exit. */ |
---|
34 | #define BAIL(e) do { \ |
---|
35 | BAIL2(e); \ |
---|
36 | goto exit; \ |
---|
37 | } while (0) |
---|
38 | |
---|
39 | /* To set retval and jump to exit, without logging error message. */ |
---|
40 | #define BAIL_QUIET(e) do { \ |
---|
41 | retval = e; \ |
---|
42 | goto 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 { \ |
---|
50 | retval = e; \ |
---|
51 | goto exit; \ |
---|
52 | } while (0) |
---|
53 | #define BAIL_QUIET BAIL |
---|
54 | #define BAIL2(e) do { \ |
---|
55 | goto 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.