Functions | Variables

ath_log.c File Reference

Functions for controlling output to stderr and stdout. More...

Go to the source code of this file.

Functions

static int ath_log_out_open (void)
 Opens output log file (containing output to stdout).
static int ath_log_err_open (void)
 Opens error log file (containing output to stderr).
void ath_log_set_level (const int out, const int err)
 Sets "output level" and "error level" from input arguments, global parameters used by many functions in this file.
void ath_log_open (const char *basename, const int lazy, const char *mode)
 Opens output and error log files if "lazy" flag is false (0).
void ath_log_close (void)
 Closes output and error log files.
FILE * athout_fp (void)
 Open output file if needed and return a pointer to file.
FILE * atherr_fp (void)
 Open error file if needed and return a pointer to file.
void ath_flush_out (void)
 Flush output file buffer.
void ath_flush_err (void)
 Flush error file buffer.
int ath_perr (const int level, const char *fmt,...)
 Foutput variable argument string to "error log file".
int ath_pout (const int level, const char *fmt,...)
 Output variable argument string to "output log file".

Variables

static int out_level = 0
static int err_level = 0
static FILE * ath_fp_out = NULL
static FILE * ath_fp_err = NULL
static char * out_fname = NULL
static char * err_fname = NULL
static int open_out_flag = 0
static int open_err_flag = 0
static char log_mode [2] = "w"

Detailed Description

Functions for controlling output to stderr and stdout.

PURPOSE: Functions for controlling output to stderr and stdout. On many machines, output to stderr and stdout does not scale well (to 10^{4-5} processors). However, having output from all MPI processes can be useful for debugging. Thus, some kind of runtime control that allows output to stderr and stdout be turned off for production runs, or redirected to files for debugging, is very helpful.

CONTAINS PUBLIC FUNCTIONS:

Definition in file ath_log.c.


Function Documentation

void ath_flush_err ( void   ) 

Flush error file buffer.

Definition at line 233 of file ath_log.c.

References ath_fp_err, and open_err_flag.

Referenced by main().

Here is the caller graph for this function:

void ath_flush_out ( void   ) 

Flush output file buffer.

Definition at line 218 of file ath_log.c.

References ath_fp_out, and open_out_flag.

Referenced by main().

Here is the caller graph for this function:

void ath_log_close ( void   ) 

Closes output and error log files.

Definition at line 172 of file ath_log.c.

References ath_fp_err, ath_fp_out, err_fname, open_err_flag, open_out_flag, and out_fname.

Referenced by main().

Here is the caller graph for this function:

static int ath_log_err_open ( void   )  [static]

Opens error log file (containing output to stderr).

Definition at line 83 of file ath_log.c.

References ath_fp_err, err_fname, log_mode, and open_err_flag.

Referenced by ath_log_open(), ath_perr(), and atherr_fp().

Here is the caller graph for this function:

void ath_log_open ( const char *  basename,
const int  lazy,
const char *  mode 
)

Opens output and error log files if "lazy" flag is false (0).

If "lazy" is true, then the ath_log_open() call does not actually open the files, but rather prepares to open them on the first invocation of either ath_pout() ath_perr(), athout_fp() or atherr_fp(). This is useful for parallel jobs where the children, if made sufficiently quiet would otherwise generate a large number of empty files. -- T. A. Gardiner --

Definition at line 133 of file ath_log.c.

References ath_log_err_open(), ath_log_out_open(), err_fname, log_mode, open_err_flag, open_out_flag, and out_fname.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static int ath_log_out_open ( void   )  [static]

Opens output log file (containing output to stdout).

Definition at line 55 of file ath_log.c.

References ath_fp_out, log_mode, open_out_flag, and out_fname.

Referenced by ath_log_open(), ath_pout(), and athout_fp().

Here is the caller graph for this function:

void ath_log_set_level ( const int  out,
const int  err 
)

Sets "output level" and "error level" from input arguments, global parameters used by many functions in this file.

Called from main(), where the parameters are parsed from athinput.

Definition at line 114 of file ath_log.c.

References err_level, and out_level.

Referenced by main().

Here is the caller graph for this function:

int ath_perr ( const int  level,
const char *  fmt,
  ... 
)

Foutput variable argument string to "error log file".

Should be used in place of printf(stderr,...)

Definition at line 250 of file ath_log.c.

References ath_fp_err, ath_log_err_open(), err_level, and open_err_flag.

Referenced by ath_strdup(), bvals_grav_fun(), bvals_mhd_fun(), bvals_mhd_init(), change_rundir(), dump_history(), dump_particle_history(), dump_restart(), exchange_feedback_fun(), exchange_feedback_init(), fluxes(), Get_Drag(), Get_Term(), getexpr(), getRGB(), init_output(), OutData1(), OutData2(), output_pdf(), problem(), rtbis(), set_bvals_particle_fun(), set_bvals_particle_init(), usage(), and Userwork_after_loop().

Here is the call graph for this function:

Here is the caller graph for this function:

int ath_pout ( const int  level,
const char *  fmt,
  ... 
)

Output variable argument string to "output log file".

Should be used in place of printf(stdout,...)

Definition at line 277 of file ath_log.c.

References ath_fp_out, ath_log_out_open(), open_out_flag, and out_level.

Referenced by ath_sig_act(), data_output_destruct(), init_output(), Integrate_Particles(), main(), problem(), realloc_recvbuf(), realloc_sendbuf(), show_config(), and shuffle().

Here is the call graph for this function:

Here is the caller graph for this function:

FILE * atherr_fp ( void   ) 

Open error file if needed and return a pointer to file.

Definition at line 205 of file ath_log.c.

References ath_fp_err, ath_log_err_open(), and open_err_flag.

Referenced by ath_error().

Here is the call graph for this function:

Here is the caller graph for this function:

FILE * athout_fp ( void   ) 

Open output file if needed and return a pointer to file.

Definition at line 192 of file ath_log.c.

References ath_fp_out, ath_log_out_open(), and open_out_flag.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

FILE * ath_fp_err = NULL [static]

Definition at line 39 of file ath_log.c.

Referenced by ath_flush_err(), ath_log_close(), ath_log_err_open(), ath_perr(), and atherr_fp().

FILE* ath_fp_out = NULL [static]

Definition at line 39 of file ath_log.c.

Referenced by ath_flush_out(), ath_log_close(), ath_log_out_open(), ath_pout(), and athout_fp().

char * err_fname = NULL [static]

Definition at line 42 of file ath_log.c.

Referenced by ath_log_close(), ath_log_err_open(), and ath_log_open().

int err_level = 0 [static]

Definition at line 36 of file ath_log.c.

Referenced by ath_log_set_level(), ath_perr(), and main().

char log_mode[2] = "w" [static]

Definition at line 48 of file ath_log.c.

Referenced by ath_log_err_open(), ath_log_open(), and ath_log_out_open().

int open_err_flag = 0 [static]
int open_out_flag = 0 [static]
char* out_fname = NULL [static]

Definition at line 42 of file ath_log.c.

Referenced by ath_log_close(), ath_log_open(), and ath_log_out_open().

int out_level = 0 [static]

Definition at line 36 of file ath_log.c.

Referenced by ath_log_set_level(), ath_pout(), and main().