A monte carlo pin cell spectral code for nuclear engineering applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
log.h
Go to the documentation of this file.
1 
11 #ifndef LOG_H_
12 #define LOG_H_
13 
14 #ifdef __cplusplus
15 #include <stdio.h>
16 #include <stdarg.h>
17 #include <stdlib.h>
18 #include <sstream>
19 #include <iostream>
20 #include <fstream>
21 #include <iomanip>
22 #include <string.h>
23 #include <stdexcept>
24 #include <time.h>
25 #include <math.h>
26 #include <sys/types.h>
27 #include <sys/stat.h>
28 #include "Python.h"
29 #endif
30 
31 #define printf PySys_WriteStdout
32 
45 typedef enum logLevels {
48 
51 
54 
57 
60 
63 
66 
69 
72 
75 
78 } logLevel;
79 
80 
88 extern void set_err(const char *msg);
89 
90 void set_output_directory(char* directory);
91 const char* get_output_directory();
92 void set_log_filename(char* filename);
93 const char* get_log_filename();
94 
95 void set_separator_character(char c);
97 void set_header_character(char c);
99 void set_title_character(char c);
100 char get_title_character();
101 void set_line_length(int length);
102 void set_log_level(const char* new_level);
103 int get_log_level();
104 
105 void log_printf(logLevel level, const char *format, ...);
106 std::string create_multiline_msg(std::string level, std::string message);
107 
108 
109 #endif /* LOG_H_ */
char get_header_character()
Returns the character used to format HEADER type log messages.
Definition: log.cpp:149
int get_log_level()
Return the minimum level for log messages printed to the screen.
Definition: log.cpp:243
Definition: log.h:47
void set_output_directory(char *directory)
Sets the output directory for log files.
Definition: log.cpp:77
char get_separator_character()
Returns the character used to format SEPARATOR log messages.
Definition: log.cpp:132
void set_log_filename(char *filename)
Sets the name for the log file.
Definition: log.cpp:105
logLevels
Logging levels characterize an ordered set of message types which may be printed to the screen...
Definition: log.h:45
Definition: log.h:77
Definition: log.h:59
void set_separator_character(char c)
Sets the character to be used when printing SEPARATOR log messages.
Definition: log.cpp:123
void set_line_length(int length)
Sets the maximum line length for log messages.
Definition: log.cpp:178
Definition: log.h:50
Definition: log.h:71
char get_title_character()
Returns the character used to format TITLE log messages.
Definition: log.cpp:167
Definition: log.h:62
void set_title_character(char c)
Sets the character to be used when printing TITLE log messages.
Definition: log.cpp:158
void set_header_character(char c)
Sets the character to be used when printing HEADER log messages.
Definition: log.cpp:140
void log_printf(logLevel level, const char *format,...)
Print a formatted message to the console.
Definition: log.cpp:255
const char * get_log_filename()
Returns the log filename.
Definition: log.cpp:114
const char * get_output_directory()
Returns the output directory for log files.
Definition: log.cpp:96
Definition: log.h:74
std::string create_multiline_msg(std::string level, std::string message)
Breaks up a message which is too long for a single line into a multiline message. ...
Definition: log.cpp:469
void set_log_level(const char *new_level)
Sets the minimum log message level which will be printed to the console and to the log file...
Definition: log.cpp:188
Definition: log.h:65
enum logLevels logLevel
Logging levels characterize an ordered set of message types which may be printed to the screen...
Definition: log.h:68
Definition: log.h:56
Definition: log.h:53
void set_err(const char *msg)
A function stub used to convert C++ exceptions into Python exceptions through SWIG.