Added a "lua" log domain.
This commit is contained in:
parent
ed5bb8ffde
commit
c95b23cd1f
3 changed files with 10 additions and 8 deletions
|
@ -54,7 +54,7 @@ log_domain general("general"), ai("ai"), formula_ai("formula_ai"), cache("cache"
|
|||
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())
|
||||
{
|
||||
|
|
|
@ -69,7 +69,7 @@ std::string get_timestamp(const time_t& t, const std::string& format="%Y%m%d %H:
|
|||
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
|
||||
{
|
||||
|
|
|
@ -39,11 +39,11 @@ extern "C" {
|
|||
|
||||
#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_dofile(lua_State *L)
|
|||
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 @@ void LuaKernel::execute(char const *prog, int nArgs, int nRets)
|
|||
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 @@ void LuaKernel::execute(char const *prog, int nArgs, int nRets)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue