yast2-core
libycp/src/include/ycp/y2log.h
Go to the documentation of this file.
1 /* y2log.h
2  *
3  * YaST2: Core system
4  *
5  * YaST2 logging implementation
6  *
7  * Authors: Mathias Kettner <kettner@suse.de>
8  * Michal Svec <msvec@suse.cz>
9  *
10  */
11 
12 #ifndef _y2log_ycp_h
13 #define _y2log_ycp_h
14 
15 #include <y2util/y2log.h>
16 #include "ExecutionEnvironment.h"
17 
18 /* YCP Errors */
19 
20 #define y2scanner(file,line,format,args...) \
21  y2_logger(LOG_ERROR,"Scanner",file,line,"",format,##args)
22 #define syn2error(file,line,format,args...) \
23  y2_logger(LOG_ERROR,"Parser",file,line,"",format,##args)
24 #define syn2warning(file,line,format,args...) \
25  y2_logger(LOG_WARNING,"Parser",file,line,"",format,##args)
26 #define sem2error(file,line,format,args...) \
27  y2_logger(LOG_ERROR,"Runtime",file,line,"",format,##args)
28 
29 #define ycp2log(level,file,line,func,format,args...) \
30  y2_logger(level,"YCP",file,line,func,format,##args)
31 
32 #define y2ycp(level,file,line,format,args...) \
33  y2_logger(level,"Interpreter",file,line,"",format,##args)
34 
35 #define ycp2debug(file,line,format,args...) \
36  y2ycp(LOG_DEBUG,file,line,format,##args)
37 #define ycp2milestone(file,line,format,args...) \
38  y2ycp(LOG_MILESTONE,file,line,format,##args)
39 #define ycp2warning(file,line,format,args...) \
40  y2ycp(LOG_WARNING,file,line,format,##args)
41 #define ycp2error(format,args...) \
42  do { \
43  y2ycp(LOG_ERROR, YaST::ee.filename().c_str(), YaST::ee.linenumber(), format, ##args); \
44  } while (0)
45 #define ycp2security(file,line,format,args...) \
46  y2ycp(LOG_SECURITY,file,line,format,##args)
47 #define ycp2internal(file,line,format,args...) \
48  y2ycp(LOG_INTERNAL,file,line,format,##args)
49 
50 // logging cleanup
51 #define ycp_log(level,format,args...) \
52  do { \
53  y2_logger(level, Y2LOG, YaST::ee.filename().c_str(), YaST::ee.linenumber(), "", format, ##args); \
54  } while (0)
55 
56 
57 #define ycperror(format,args...) \
58  ycp_log(LOG_ERROR, format, ##args)
59 
60 #define ycpwarning(format,args...) \
61  ycp_log(LOG_WARNING, format, ##args)
62 
63 #define ycpdebug(format,args...) \
64  ycp_log(LOG_DEBUG, format, ##args)
65 
66 #define ycpinternal(format,args...) \
67  ycp_log(LOG_INTERNAL, format, ##args)
68 
69 #define ycpmilestone(format,args...) \
70  ycp_log(LOG_MILESTONE, format, ##args)
71 
73 class Logger {
74 public:
75  virtual ~Logger() {}
76  virtual void error(string error) = 0;
77  virtual void warning(string warning) = 0;
78 };
79 
80 #endif /* _y2log_ycp_h */
c++ interface for logging
Definition: libycp/src/include/ycp/y2log.h:73
virtual ~Logger()
Definition: libycp/src/include/ycp/y2log.h:75
virtual void warning(string warning)=0
virtual void error(string error)=0

Generated on a sunny day for yast2-core by doxygen 1.8.5