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").
No messages in logfile from LUA?
Moderator: leecollings
-
Bikey
- Posts: 331
- Joined: Sunday 22 February 2015 12:19
- Target OS: Linux
- Domoticz version: 2020.x
- Location: Netherlands
- Contact:
Re: No messages in logfile from LUA?
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?
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?
-
Bikey
- Posts: 331
- Joined: Sunday 22 February 2015 12:19
- Target OS: Linux
- Domoticz version: 2020.x
- Location: Netherlands
- Contact:
Re: No messages in logfile from LUA?
Is it only me having this issue?
- jvdz
- Posts: 2445
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: No messages in logfile from LUA?
Could be the LUA log messages are not considered Status or Error messages, so why not simply leave it on 0?-loglevel (0=All, 1=Status+Error, 2=Error)
Jos
-
Bikey
- Posts: 331
- Joined: Sunday 22 February 2015 12:19
- Target OS: Linux
- Domoticz version: 2020.x
- Location: Netherlands
- Contact:
Re: No messages in logfile from LUA?
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
- jvdz
- Posts: 2445
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: No messages in logfile from LUA?
Just had a quick look at the source and think the Blockly writes with "LOG_STATUS" level:
and LUA with "LOG_NORM":
So guess that needs an update to "LOG_STATUS" to get the same behavior. 
Jos
Code: Select all
if (devNameNoQuotes == "WriteToLogText")
{
_log.Log(LOG_STATUS, "%s", doWhat.c_str());
}Code: Select all
_log.Log(LOG_NORM, "LUA: %s", lua_tostring(lua_state, i));Jos
-
Bikey
- Posts: 331
- Joined: Sunday 22 February 2015 12:19
- Target OS: Linux
- Domoticz version: 2020.x
- Location: Netherlands
- Contact:
Re: No messages in logfile from LUA?
Thanks for looking that up, but what is the "LOG_NORM" level? Apparently that equals to loglevel = 0?
- jvdz
- Posts: 2445
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: No messages in logfile from LUA?
I am not that familiar with the domoticz source yet, but these are the options defined in logger.h:
Jos
Code: Select all
enum _eLogLevel
{
LOG_NORM=0,
LOG_ERROR,
LOG_STATUS,
};
Who is online
Users browsing this forum: No registered users and 1 guest