Fawkes API  Fawkes Development Version
fawkeslogging_tolua.cpp
1 /*
2 ** Lua binding: fawkeslogging
3 ** Generated automatically by tolua++-1.0.92
4 */
5 /* This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version. A runtime exception applies to
9  * this software (see LICENSE.GPL_WRE file mentioned below for details).
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Library General Public License for more details.
15  *
16  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
17  */
18 
19 #include <core/exception.h>
20 
21 #ifndef __cplusplus
22 #include "stdlib.h"
23 #endif
24 #include "string.h"
25 
26 #include "tolua++.h"
27 
28 /* Exported function */
29 TOLUA_API int tolua_fawkeslogging_open (lua_State* tolua_S);
30 
31 #include <logging/component.h>
32 
33 /* function to register type */
34 static void tolua_reg_types (lua_State* tolua_S)
35 {
36  tolua_usertype(tolua_S,"fawkes::ComponentLogger");
37 }
38 
39 /* method: log_debug of class fawkes::ComponentLogger */
40 #ifndef TOLUA_DISABLE_tolua_fawkeslogging_fawkes_ComponentLogger_log_debug00
41 static int tolua_fawkeslogging_fawkes_ComponentLogger_log_debug00(lua_State* tolua_S)
42 {
43 #ifndef TOLUA_RELEASE
44  tolua_Error tolua_err;
45  if (
46  !tolua_isusertype(tolua_S,1,"fawkes::ComponentLogger",0,&tolua_err) ||
47  !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
48  !tolua_isnoobj(tolua_S,3,&tolua_err)
49  )
50  goto tolua_lerror;
51  else
52 #endif
53  {
54  fawkes::ComponentLogger* self = (fawkes::ComponentLogger*) tolua_tousertype(tolua_S,1,0);
55  std::string message = ((std::string) tolua_tocppstring(tolua_S,2,0));
56 #ifndef TOLUA_RELEASE
57  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'log_debug'", NULL);
58 #endif
59  bool exc_caught = false;
60  try {
61  {
62  self->log_debug(message);
63  }
64  } catch (fawkes::Exception &e) {
65  exc_caught = true;
66  lua_pushstring(tolua_S, e.what_no_backtrace());
67  }
68  catch (std::exception &e) {
69  exc_caught = true;
70  lua_pushstring(tolua_S, e.what());
71  }
72  if (exc_caught) lua_error(tolua_S);
73 
74  }
75  return 0;
76 #ifndef TOLUA_RELEASE
77  tolua_lerror:
78  tolua_error(tolua_S,"#ferror in function 'log_debug'.",&tolua_err);
79  return 0;
80 #endif
81 }
82 #endif //#ifndef TOLUA_DISABLE
83 
84 /* method: log_info of class fawkes::ComponentLogger */
85 #ifndef TOLUA_DISABLE_tolua_fawkeslogging_fawkes_ComponentLogger_log_info00
86 static int tolua_fawkeslogging_fawkes_ComponentLogger_log_info00(lua_State* tolua_S)
87 {
88 #ifndef TOLUA_RELEASE
89  tolua_Error tolua_err;
90  if (
91  !tolua_isusertype(tolua_S,1,"fawkes::ComponentLogger",0,&tolua_err) ||
92  !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
93  !tolua_isnoobj(tolua_S,3,&tolua_err)
94  )
95  goto tolua_lerror;
96  else
97 #endif
98  {
99  fawkes::ComponentLogger* self = (fawkes::ComponentLogger*) tolua_tousertype(tolua_S,1,0);
100  std::string message = ((std::string) tolua_tocppstring(tolua_S,2,0));
101 #ifndef TOLUA_RELEASE
102  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'log_info'", NULL);
103 #endif
104  bool exc_caught = false;
105  try {
106  {
107  self->log_info(message);
108  }
109  } catch (fawkes::Exception &e) {
110  exc_caught = true;
111  lua_pushstring(tolua_S, e.what_no_backtrace());
112  }
113  catch (std::exception &e) {
114  exc_caught = true;
115  lua_pushstring(tolua_S, e.what());
116  }
117  if (exc_caught) lua_error(tolua_S);
118 
119  }
120  return 0;
121 #ifndef TOLUA_RELEASE
122  tolua_lerror:
123  tolua_error(tolua_S,"#ferror in function 'log_info'.",&tolua_err);
124  return 0;
125 #endif
126 }
127 #endif //#ifndef TOLUA_DISABLE
128 
129 /* method: log_warn of class fawkes::ComponentLogger */
130 #ifndef TOLUA_DISABLE_tolua_fawkeslogging_fawkes_ComponentLogger_log_warn00
131 static int tolua_fawkeslogging_fawkes_ComponentLogger_log_warn00(lua_State* tolua_S)
132 {
133 #ifndef TOLUA_RELEASE
134  tolua_Error tolua_err;
135  if (
136  !tolua_isusertype(tolua_S,1,"fawkes::ComponentLogger",0,&tolua_err) ||
137  !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
138  !tolua_isnoobj(tolua_S,3,&tolua_err)
139  )
140  goto tolua_lerror;
141  else
142 #endif
143  {
144  fawkes::ComponentLogger* self = (fawkes::ComponentLogger*) tolua_tousertype(tolua_S,1,0);
145  std::string message = ((std::string) tolua_tocppstring(tolua_S,2,0));
146 #ifndef TOLUA_RELEASE
147  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'log_warn'", NULL);
148 #endif
149  bool exc_caught = false;
150  try {
151  {
152  self->log_warn(message);
153  }
154  } catch (fawkes::Exception &e) {
155  exc_caught = true;
156  lua_pushstring(tolua_S, e.what_no_backtrace());
157  }
158  catch (std::exception &e) {
159  exc_caught = true;
160  lua_pushstring(tolua_S, e.what());
161  }
162  if (exc_caught) lua_error(tolua_S);
163 
164  }
165  return 0;
166 #ifndef TOLUA_RELEASE
167  tolua_lerror:
168  tolua_error(tolua_S,"#ferror in function 'log_warn'.",&tolua_err);
169  return 0;
170 #endif
171 }
172 #endif //#ifndef TOLUA_DISABLE
173 
174 /* method: log_error of class fawkes::ComponentLogger */
175 #ifndef TOLUA_DISABLE_tolua_fawkeslogging_fawkes_ComponentLogger_log_error00
176 static int tolua_fawkeslogging_fawkes_ComponentLogger_log_error00(lua_State* tolua_S)
177 {
178 #ifndef TOLUA_RELEASE
179  tolua_Error tolua_err;
180  if (
181  !tolua_isusertype(tolua_S,1,"fawkes::ComponentLogger",0,&tolua_err) ||
182  !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
183  !tolua_isnoobj(tolua_S,3,&tolua_err)
184  )
185  goto tolua_lerror;
186  else
187 #endif
188  {
189  fawkes::ComponentLogger* self = (fawkes::ComponentLogger*) tolua_tousertype(tolua_S,1,0);
190  std::string message = ((std::string) tolua_tocppstring(tolua_S,2,0));
191 #ifndef TOLUA_RELEASE
192  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'log_error'", NULL);
193 #endif
194  bool exc_caught = false;
195  try {
196  {
197  self->log_error(message);
198  }
199  } catch (fawkes::Exception &e) {
200  exc_caught = true;
201  lua_pushstring(tolua_S, e.what_no_backtrace());
202  }
203  catch (std::exception &e) {
204  exc_caught = true;
205  lua_pushstring(tolua_S, e.what());
206  }
207  if (exc_caught) lua_error(tolua_S);
208 
209  }
210  return 0;
211 #ifndef TOLUA_RELEASE
212  tolua_lerror:
213  tolua_error(tolua_S,"#ferror in function 'log_error'.",&tolua_err);
214  return 0;
215 #endif
216 }
217 #endif //#ifndef TOLUA_DISABLE
218 
219 /* Open function */
220 TOLUA_API int tolua_fawkeslogging_open (lua_State* tolua_S)
221 {
222  tolua_open(tolua_S);
223  tolua_reg_types(tolua_S);
224  tolua_module(tolua_S,NULL,0);
225  tolua_beginmodule(tolua_S,NULL);
226  tolua_module(tolua_S,"fawkes",0);
227  tolua_beginmodule(tolua_S,"fawkes");
228  tolua_cclass(tolua_S,"ComponentLogger","fawkes::ComponentLogger","",NULL);
229  tolua_beginmodule(tolua_S,"ComponentLogger");
230  tolua_function(tolua_S,"log_debug",tolua_fawkeslogging_fawkes_ComponentLogger_log_debug00);
231  tolua_function(tolua_S,"log_info",tolua_fawkeslogging_fawkes_ComponentLogger_log_info00);
232  tolua_function(tolua_S,"log_warn",tolua_fawkeslogging_fawkes_ComponentLogger_log_warn00);
233  tolua_function(tolua_S,"log_error",tolua_fawkeslogging_fawkes_ComponentLogger_log_error00);
234  tolua_endmodule(tolua_S);
235  tolua_endmodule(tolua_S);
236  tolua_endmodule(tolua_S);
237  return 1;
238 }
239 
240 
241 extern "C" {
242 #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
243  TOLUA_API int luaopen_fawkeslogging (lua_State* tolua_S) {
244  return tolua_fawkeslogging_open(tolua_S);
245 };
246 #endif
247 }
248 
249 
Base class for exceptions in Fawkes.
Definition: exception.h:36
virtual const char * what_no_backtrace() const
Get primary string (does not implicitly print the back trace).
Definition: exception.cpp:686
Component logger.
Definition: component.h:35