mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Move logHelper and its namespace to the top of LuaAPI.cpp
This commit is contained in:
parent
21152a23cc
commit
0051f00ce7
1 changed files with 16 additions and 14 deletions
|
@ -16,6 +16,22 @@
|
||||||
# include <QLoggingCategory>
|
# include <QLoggingCategory>
|
||||||
# include <QTextCodec>
|
# include <QTextCodec>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
using namespace chatterino;
|
||||||
|
|
||||||
|
void logHelper(lua_State *L, Plugin *pl, QDebug stream, int argc)
|
||||||
|
{
|
||||||
|
stream.noquote();
|
||||||
|
stream << "[" + pl->id + ":" + pl->meta.name + "]";
|
||||||
|
for (int i = 1; i <= argc; i++)
|
||||||
|
{
|
||||||
|
stream << lua::toString(L, i);
|
||||||
|
}
|
||||||
|
lua_pop(L, argc);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
// NOLINTBEGIN(*vararg)
|
// NOLINTBEGIN(*vararg)
|
||||||
// luaL_error is a c-style vararg function, this makes clang-tidy not dislike it so much
|
// luaL_error is a c-style vararg function, this makes clang-tidy not dislike it so much
|
||||||
namespace chatterino::lua::api {
|
namespace chatterino::lua::api {
|
||||||
|
@ -101,20 +117,6 @@ int c2_system_msg(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
|
||||||
void logHelper(lua_State *L, Plugin *pl, QDebug stream, int argc)
|
|
||||||
{
|
|
||||||
stream.noquote();
|
|
||||||
stream << "[" + pl->id + ":" + pl->meta.name + "]";
|
|
||||||
for (int i = 1; i <= argc; i++)
|
|
||||||
{
|
|
||||||
stream << lua::toString(L, i);
|
|
||||||
}
|
|
||||||
lua_pop(L, argc);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
int c2_log(lua_State *L)
|
int c2_log(lua_State *L)
|
||||||
{
|
{
|
||||||
auto *pl = getApp()->plugins->getPluginByStatePtr(L);
|
auto *pl = getApp()->plugins->getPluginByStatePtr(L);
|
||||||
|
|
Loading…
Reference in a new issue