write_to_logs
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
write_to_logs [2019/01/09 10:28] – created akuzmuk | write_to_logs [2021/07/23 15:05] – [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, | ||
- | 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 |
- | ==== INFO(message) ==== | + | <code lua> |
+ | local result | ||
- | 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 |
+ | | ||
+ | else | ||
+ | | ||
+ | DEBUG(" | ||
+ | end | ||
+ | end | ||
+ | </ | ||
- | ==== 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 ==== | ||
+ | |||
+ | You can implement your version of log output function with more complex formatting (e.g. table output or json output), wrapping the basics functions into your Lua code ([[useful_programs# | ||
===== Writing to message log ===== | ===== Writing to message log ===== | ||
- | ==== AddInfoMessage(message, | + | **AddInfoMessage |
- | 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. | + | |
+ | The functions add the message **message** with their respective | ||
- | **AddWarningMessage** and **AddAlertMessage** - are full analogs of AddInfoMessage, | + | **** and **** - are full analogs of AddInfoMessage, |
write_to_logs.txt · Last modified: 2021/07/23 15:06 by emozolyak