19 #include <core/exception.h> 29 TOLUA_API
int tolua_fawkeslogging_open (lua_State* tolua_S);
31 #include <logging/component.h> 34 static void tolua_reg_types (lua_State* tolua_S)
36 tolua_usertype(tolua_S,
"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)
44 tolua_Error tolua_err;
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)
55 std::string message = ((std::string) tolua_tocppstring(tolua_S,2,0));
57 if (!
self) tolua_error(tolua_S,
"invalid 'self' in function 'log_debug'", NULL);
59 bool exc_caught =
false;
62 self->log_debug(message);
68 catch (std::exception &e) {
70 lua_pushstring(tolua_S, e.what());
72 if (exc_caught) lua_error(tolua_S);
78 tolua_error(tolua_S,
"#ferror in function 'log_debug'.",&tolua_err);
82 #endif //#ifndef TOLUA_DISABLE 85 #ifndef TOLUA_DISABLE_tolua_fawkeslogging_fawkes_ComponentLogger_log_info00 86 static int tolua_fawkeslogging_fawkes_ComponentLogger_log_info00(lua_State* tolua_S)
89 tolua_Error tolua_err;
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)
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);
104 bool exc_caught =
false;
107 self->log_info(message);
113 catch (std::exception &e) {
115 lua_pushstring(tolua_S, e.what());
117 if (exc_caught) lua_error(tolua_S);
121 #ifndef TOLUA_RELEASE 123 tolua_error(tolua_S,
"#ferror in function 'log_info'.",&tolua_err);
127 #endif //#ifndef TOLUA_DISABLE 130 #ifndef TOLUA_DISABLE_tolua_fawkeslogging_fawkes_ComponentLogger_log_warn00 131 static int tolua_fawkeslogging_fawkes_ComponentLogger_log_warn00(lua_State* tolua_S)
133 #ifndef TOLUA_RELEASE 134 tolua_Error tolua_err;
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)
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);
149 bool exc_caught =
false;
152 self->log_warn(message);
158 catch (std::exception &e) {
160 lua_pushstring(tolua_S, e.what());
162 if (exc_caught) lua_error(tolua_S);
166 #ifndef TOLUA_RELEASE 168 tolua_error(tolua_S,
"#ferror in function 'log_warn'.",&tolua_err);
172 #endif //#ifndef TOLUA_DISABLE 175 #ifndef TOLUA_DISABLE_tolua_fawkeslogging_fawkes_ComponentLogger_log_error00 176 static int tolua_fawkeslogging_fawkes_ComponentLogger_log_error00(lua_State* tolua_S)
178 #ifndef TOLUA_RELEASE 179 tolua_Error tolua_err;
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)
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);
194 bool exc_caught =
false;
197 self->log_error(message);
203 catch (std::exception &e) {
205 lua_pushstring(tolua_S, e.what());
207 if (exc_caught) lua_error(tolua_S);
211 #ifndef TOLUA_RELEASE 213 tolua_error(tolua_S,
"#ferror in function 'log_error'.",&tolua_err);
217 #endif //#ifndef TOLUA_DISABLE 220 TOLUA_API
int tolua_fawkeslogging_open (lua_State* 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);
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);
Base class for exceptions in Fawkes.
virtual const char * what_no_backtrace() const
Get primary string (does not implicitly print the back trace).