User Tools

Site Tools


write_to_logs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
write_to_logs [2020/01/02 11:02] – [TRACE(message)] emozolyakwrite_to_logs [2021/07/23 15:06] (current) – [Writing to message log] emozolyak
Line 2: Line 2:
 ===== Writing to communication log ===== ===== Writing to communication log =====
  
-==== ERROR(message) ====+There are 4 functions for writing to the communication log: 
 +**INFO, ERROR, DEBUG, TRACE**
  
-The function adds the **message** with the ERROR level to communication log (**Maintenance -> WebHMI Log**). Function returns 1 if any error occurred and 0 on success.+The functions add the **message** with the their respective detail level to communication log. Function returns 1 if any error occurred and 0 on success.
  
-==== INFO(message====+<code lua> 
 +local result getResult()
  
-The function adds the **message** with the INFO level to communication log (**Maintenance -WebHMI Log**). Function returns 1 if any error occurred and 0 on success.+if (not result) then  
 +   ERROR("Nil was calculated in the getResult"
 +else  
 +   if (result 100then  
 +      DEBUG("The result is out of range...") 
 +   end  
 +end  
 +</code>
  
-==== DEBUG(message) ==== 
  
-The function adds the **message** with the DEBUG level to communication log (**Maintenance -> WebHMI Log**). Function returns 1 if any error occurred and 0 on success. 
  
-==== TRACE(message) ==== 
  
-The function adds the **message** with the TRACE level to communication log (**Maintenance -> WebHMI Log**). Function returns 1 if any error occurred and 0 on success. 
  
 ==== Customize log output ==== ==== Customize log output ====
Line 23: Line 28:
 ===== Writing to message log ===== ===== Writing to message log =====
  
-==== AddInfoMessage(message, userId)==== +**AddInfoMessage | AddWarningMessage | AddAlertMessage**(//message////userId//
-The AddInfoMessage function adds the message **message** with the Info level to the Messages log. **userId** is the user ID on whose behalf the message should be added. Returns 1 if an error occurred and 0 if successful.+
  
-**AddWarningMessage** and **AddAlertMessage** - are full analogs of AddInfoMessage, writing to Warning and Alert message levels respectively+The functions add the text //message// with their respective level to the messages log. //userId// is the user ID on whose behalf the message should be added. Returns 1 if an error occurred and 0 if successful.
  
write_to_logs.1577962959.txt.gz · Last modified: 2020/01/02 11:02 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki