Page 1 of 1
No messages in logfile from LUA?
Posted: Saturday 26 March 2016 10:47
by Bikey
Hi,
I'm having probably a simple problem: If I put a "print" statement in my LUA-scripts (using the internal editor, with V3.4834 stable) nothing appears in the logfile, why is that?
If I use the print statement within Blockly-scripts it does work fine.
(Loglevel from Domoticz is set to "1").
Re: No messages in logfile from LUA?
Posted: Sunday 27 March 2016 14:56
by Bikey
UPDATE: if I set the loglevel to 0 the print messages from LUA show up.
That is however not implemented consequently: if I put a "print" in my Blockly scripts the messages always show up, so I would expect from LUA the same behavior.
Can that be fixed so that LUA behaves the same as Blockly with respect to logging, preferably to always show up so I can make the intelligence to do the loging in my scripts and not depend on a global setting?
Re: No messages in logfile from LUA?
Posted: Wednesday 30 March 2016 11:45
by Bikey
Is it only me having this issue?
Re: No messages in logfile from LUA?
Posted: Wednesday 30 March 2016 12:12
by jvdz
-loglevel (0=All, 1=Status+Error, 2=Error)
Could be the LUA log messages are not considered Status or Error messages, so why not simply leave it on 0?
Jos
Re: No messages in logfile from LUA?
Posted: Wednesday 30 March 2016 13:13
by Bikey
That is a temporary solution, but if I do that my logfile (on a RAM-drive) fills up to much to fast. So for a real solution this needs to be implemented correctly, like it is done for Blockly
Re: No messages in logfile from LUA?
Posted: Wednesday 30 March 2016 13:22
by jvdz
Just had a quick look at the source and think the Blockly writes with "LOG_STATUS" level:
Code: Select all
if (devNameNoQuotes == "WriteToLogText")
{
_log.Log(LOG_STATUS, "%s", doWhat.c_str());
}
and LUA with "LOG_NORM":
Code: Select all
_log.Log(LOG_NORM, "LUA: %s", lua_tostring(lua_state, i));
So guess that needs an update to "LOG_STATUS" to get the same behavior.
Jos
Re: No messages in logfile from LUA?
Posted: Wednesday 30 March 2016 13:57
by Bikey
Thanks for looking that up, but what is the "LOG_NORM" level? Apparently that equals to loglevel = 0?
Re: No messages in logfile from LUA?
Posted: Wednesday 30 March 2016 14:46
by jvdz
I am not that familiar with the domoticz source yet, but these are the options defined in logger.h:
Code: Select all
enum _eLogLevel
{
LOG_NORM=0,
LOG_ERROR,
LOG_STATUS,
};
Jos