mail[Wesnoth-commits] r34096 - in /trunk/src: log.cpp log.hpp scripting/lua.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on March 24, 2009 - 21:01:
Author: silene
Date: Tue Mar 24 21:01:07 2009
New Revision: 34096

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34096&view=rev
Log:
Added a "lua" log domain.

Modified:
    trunk/src/log.cpp
    trunk/src/log.hpp
    trunk/src/scripting/lua.cpp

Modified: trunk/src/log.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/log.cpp?rev=34096&r1=34095&r2=34096&view=diff
==============================================================================
--- trunk/src/log.cpp (original)
+++ trunk/src/log.cpp Tue Mar 24 21:01:07 2009
@@ -54,7 +54,7 @@
        filesystem("filesystem"), audio("audio"),
        replay("replay"), help("help"), gui("gui"), gui_parse("gui_parse"),
        gui_draw("gui_draw"), gui_layout("gui_layout"), 
gui_event("gui_event"), editor("editor"), wml("wml"),
-       mp_user_handler("user_handler");
+       mp_user_handler("user_handler"), lua("lua");
 
 log_domain::log_domain(char const *name) : domain_(log_domains.size())
 {

Modified: trunk/src/log.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/log.hpp?rev=34096&r1=34095&r2=34096&view=diff
==============================================================================
--- trunk/src/log.hpp (original)
+++ trunk/src/log.hpp Tue Mar 24 21:01:07 2009
@@ -69,7 +69,7 @@
 extern logger err, warn, info, debug;
 extern log_domain general, ai, formula_ai, cache, config, display, engine, 
network, mp_server,
        filesystem, audio, replay, help, gui, gui_parse, gui_layout, gui_draw,
-       gui_event, editor, wml, mp_user_handler;
+       gui_event, editor, wml, mp_user_handler, lua;
 
 class scope_logger
 {

Modified: trunk/src/scripting/lua.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/scripting/lua.cpp?rev=34096&r1=34095&r2=34096&view=diff
==============================================================================
--- trunk/src/scripting/lua.cpp (original)
+++ trunk/src/scripting/lua.cpp Tue Mar 24 21:01:07 2009
@@ -39,11 +39,11 @@
 
 #include <cassert>
 #include <cstring>
-#include <iostream>
 
 #include "filesystem.hpp"
 #include "foreach.hpp"
 #include "gamestatus.hpp"
+#include "log.hpp"
 #include "scripting/lua.hpp"
 #include "unit.hpp"
 
@@ -518,7 +518,7 @@
 static int lua_message(lua_State *L)
 {
        char const *m = luaL_checkstring(L, 1);
-       std::cerr << "Lua script says: \"" << m << "\"\n";
+       LOG_STREAM(info, lua) << "Script says: \"" << m << "\"\n";
        return 0;
 }
 
@@ -689,8 +689,9 @@
        int res = luaL_loadstring(L, prog);
        if (res)
        {
-               std::cerr << "Failure while loading Lua script: "
-                         << lua_tostring(L, -1) << '\n';
+               LOG_STREAM(err, lua)
+                       << "Failure while loading Lua script: "
+                       << lua_tostring(L, -1) << '\n';
                lua_pop(L, 2);
                return;
        }
@@ -702,8 +703,9 @@
        res = lua_pcall(L, nArgs, nRets, -2 - nArgs);
        if (res)
        {
-               std::cerr << "Failure while running Lua script: "
-                         << lua_tostring(L, -1) << '\n';
+               LOG_STREAM(err, lua)
+                       << "Failure while running Lua script: "
+                       << lua_tostring(L, -1) << '\n';
                lua_pop(L, 2);
                return;
        }




Related Messages


Powered by MHonArc, Updated Tue Mar 24 21:40:34 2009