debug.h
Go to the documentation of this file.
/*
Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
Copyright (C) 2022 The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/
#ifndef DEBUG_H
#define DEBUG_H
#include "int_sizes.h"
#include <unistd.h>
#include <sys/types.h>
#include <stdarg.h>
#include <stdio.h>
/* priority */
#define D_INFO (0LL)
#define D_FATAL (1LL<<0)
#define D_ERROR (1LL<<1)
#define D_NOTICE (1LL<<2)
#define D_DEBUG (1LL<<3)
/* subsystem */
#define D_SYSCALL (1LL<<4)
#define D_CHANNEL (1LL<<5)
#define D_PROCESS (1LL<<6)
#define D_RESOLVE (1LL<<7)
#define D_LIBCALL (1LL<<8)
#define D_LOCAL (1LL<<9)
#define D_DNS (1LL<<10)
#define D_TCP (1LL<<11)
#define D_AUTH (1LL<<12)
#define D_IRODS (1LL<<13)
#define D_CVMFS (1LL<<14)
#define D_HTTP (1LL<<15)
#define D_FTP (1LL<<16)
#define D_NEST (1LL<<17)
#define D_GROW (1LL<<18)
#define D_CHIRP (1LL<<19)
#define D_DCAP (1LL<<20)
#define D_RFIO (1LL<<21)
#define D_GLITE (1LL<<22)
#define D_MULTI (1LL<<23)
#define D_PSTREE (1LL<<24)
#define D_ALLOC (1LL<<25)
#define D_LFC (1LL<<26)
#define D_GFAL (1LL<<27)
#define D_SUMMARY (1LL<<28)
#define D_LOGIN (1LL<<29)
#define D_CACHE (1LL<<30)
#define D_POLL (1LL<<31)
#define D_HDFS (1LL<<32)
#define D_WQ (1LL<<33)
#define D_BXGRID (1LL<<34)
#define D_USER (1LL<<35)
#define D_XROOTD (1LL<<36)
#define D_MPI (1LL<<37)
#define D_BATCH (1LL<<38)
#define D_RMON (1LL<<39)
#define D_MAKEFLOW_RUN (1LL<<40)
#define D_MAKEFLOW_LEXER (1LL<<41)
#define D_MAKEFLOW_PARSER (1LL<<42)
#define D_MAKEFLOW_ALLOC (1LL<<43)
#define D_CONFUGA (1LL<<44)
#define D_JX (1LL<<45)
#define D_MAKEFLOW_HOOK (1LL<<46)
#define D_EXT (1LL<<47)
#define D_VINE (1LL<<48)
#define D_TLQ (1LL<<49)
#define D_SSL (1LL<<50)
#define D_BUCKETING (1LL<<51)
#define D_REMOTE (D_HTTP|D_FTP|D_NEST|D_CHIRP|D_DCAP|D_RFIO|D_LFC|D_GFAL|D_MULTI|D_GROW|D_IRODS|D_HDFS|D_BXGRID|D_XROOTD|D_CVMFS)
#define D_MAKEFLOW (D_MAKEFLOW_RUN|D_MAKEFLOW_LEXER|D_MAKEFLOW_PARSER)
#define D_ALL (~(0LL))
/*
It turns out that many libraries and tools make use of symbols like "debug" and
"fatal". This causes strange failures when we link against such codes. Rather
than change all of our code, we simply insert these defines to transparently
modify the linker namespace we are using.
*/
#ifndef DOXYGEN
#define debug cctools_debug
#define fatal cctools_fatal
#define notice cctools_notice
#define warn cctools_warn
#define debug_config cctools_debug_config
#define debug_config_file cctools_debug_config_file
#define debug_config_file_size cctools_debug_config_file_size
#define debug_config_fatal cctools_debug_config_fatal
#define debug_config_child_getpid cctools_debug_config_child_getpid
#define debug_flags_set cctools_debug_flags_set
#define debug_flags_print cctools_debug_flags_print
#define debug_flags_clear cctools_debug_flags_clear
#define debug_flags_restore cctools_debug_flags_restore
#define debug_set_flag_name cctools_debug_set_flag_name
#define debug_rename cctools_debug_rename
#endif
void debug(int64_t flags, const char *fmt, ...)
#ifndef SWIG
__attribute__ (( format(printf,2,3) ))
#endif
;
void vdebug(int64_t flags, const char *fmt, va_list args);
void warn(int64_t flags, const char *fmt, ...);
void fatal(const char *fmt, ...);
void notice(int64_t flags, const char *fmt, ...);
void debug_config(const char *name);
void debug_config_file(const char *file);
int debug_config_file_e(const char *file);
void debug_config_file_size(off_t size);
void debug_config_fatal(void (*callback) (void));
void debug_config_child_getpid (pid_t (*getpidf)(void));
int debug_flags_set(const char *flagname);
void debug_flags_print(FILE * stream);
int64_t debug_flags_clear(void);
void debug_set_flag_name(int64_t flag, const char *name);
void debug_flags_restore(int64_t flags);
void debug_rename(const char *suffix);
void debug_reopen(void);
void debug_close(void);
/* LDEBUG likes debug, but also print the code location.
* NOTE: the caller of this macro must supply at least one argument after the format string.
*/
#define LDEBUG(fmt, ...) debug(D_DEBUG, "%s:%s:%d[%s]: " fmt, __func__, __FILE__, __LINE__, CCTOOLS_SOURCE, __VA_ARGS__)
#endif
notice
void notice(int64_t flags, const char *fmt,...)
Emit a notice message.
debug_reopen
void debug_reopen(void)
Reopen the debug stream.
debug_flags_set
int debug_flags_set(const char *flagname)
Set debugging flags to enable output.
debug
void debug(int64_t flags, const char *fmt,...) __attribute__((format(printf
Emit a debugging message.
debug_config_file
void debug_config_file(const char *file)
Direct debug output to a file.
debug_config
void debug_config(const char *name)
Initialize the debugging system.
vdebug
void void vdebug(int64_t flags, const char *fmt, va_list args)
Emit a debugging message.
debug_config_file_size
void debug_config_file_size(off_t size)
Set the maximum debug file size.
fatal
void fatal(const char *fmt,...)
Emit a fatal debugging message and terminate with SIGTERM.
debug_rename
void debug_rename(const char *suffix)
Rename debug file with given suffix.
debug_close
void debug_close(void)
Close the debug stream (only for disk files, no stderr or stdout).
debug_flags_restore
void debug_flags_restore(int64_t flags)
Restore debug flags.
debug_set_flag_name
void debug_set_flag_name(int64_t flag, const char *name)
Set name of flag combination Sets the string value associated with flag.
debug_flags_clear
int64_t debug_flags_clear(void)
Clear all debugging flags.
warn
void warn(int64_t flags, const char *fmt,...)
Emit a warning message.
debug_flags_print
void debug_flags_print(FILE *stream)
Display the available debug flags.