PARALUTION  1.0.0
PARALUTION
log.hpp
Go to the documentation of this file.
1 #ifndef PARALUTION_UTILS_LOG_HPP_
2 #define PARALUTION_UTILS_LOG_HPP_
3 
4 #include "def.hpp"
5 #include "../base/backend_manager.hpp"
6 
7 #include <iostream>
8 #include <stdlib.h>
9 
10 namespace paralution {
11 
12 void _paralution_open_log_file(void);
14 
15 }
16 
17 // Do not edit
18 #ifdef DEBUG_MODE
19 
20 #undef VERBOSE_LEVEL
21 #define VERBOSE_LEVEL 10
22 
23 #endif
24 
25 
26 // Do not edit
27 #ifdef LOG_FILE
28 
29 #define LOG_STREAM *(_get_backend_descriptor()->log_file)
30 
31 #else
32 
33 #define LOG_STREAM std::cout
34 
35 #endif
36 
37 // LOG INFO
38 #define LOG_INFO(stream) { \
39  LOG_STREAM << stream << std::endl; \
40  }
41 
42 
43 // LOG ERROR
44 #define FATAL_ERROR(file, line) { \
45  LOG_INFO("Fatal error - the program will be terminated "); \
46  LOG_INFO("File: " << file << "; line: " << line); \
47  exit(1); \
48 }
49 
50 
51 // LOG VERBOSE
52 #ifdef VERBOSE_LEVEL
53 
54 #define LOG_VERBOSE_INFO(level, stream) { \
55  if (level <= VERBOSE_LEVEL) \
56  LOG_STREAM << stream << std::endl; \
57  }
58 
59 #else
60 
61 #define LOG_VERBOSE_INFO(level, stream) ;
62 
63 #endif
64 
65 
66 // LOG DEBUG
67 #ifdef DEBUG_MODE
68 
69 #define LOG_DEBUG(obj, fct, stream) { \
70  LOG_STREAM << "# Obj addr: " << obj \
71  << "; fct: " << fct \
72  << " " << stream << std::endl; \
73  }
74 
75 #else
76 
77 #define LOG_DEBUG(obj, fct, stream) ;
78 
79 #endif
80 
81 
82 #endif // PARALUTION_UTILS_LOG_HPP_
void _paralution_open_log_file(void)
Definition: log.cpp:14
void _paralution_close_log_file(void)
Definition: log.cpp:46
Definition: backend_manager.cpp:43