| 1 |
.. _lua_log_api: |
| 2 |
|
| 3 |
Debug Logging |
| 4 |
============= |
| 5 |
|
| 6 |
Constructors |
| 7 |
~~~~~~~~~~~~ |
| 8 |
|
| 9 |
.. function:: Log.open_topic(topic) |
| 10 |
|
| 11 |
Opens a LogTopic with the given topic name. Well known script topics are |
| 12 |
described in :ref:`daemon_logging`, and messages from scripts shall use |
| 13 |
**s-***. |
| 14 |
|
| 15 |
Example: |
| 16 |
|
| 17 |
.. code-block:: lua |
| 18 |
|
| 19 |
local obj |
| 20 |
log = Log.open_topic ("s-linking") |
| 21 |
log:info (obj, "an info message on obj") |
| 22 |
log:debug ("a debug message") |
| 23 |
|
| 24 |
Above example shows how to output debug logs. |
| 25 |
|
| 26 |
:param string topic: The log topic to open |
| 27 |
:returns: the log topic object |
| 28 |
:rtype: Log (:c:struct:`WpLogTopic`) |
| 29 |
|
| 30 |
Methods |
| 31 |
~~~~~~~ |
| 32 |
|
| 33 |
.. function:: Log.warning(object, message) |
| 34 |
|
| 35 |
Logs a warning message, like :c:macro:`wp_warning_object` |
| 36 |
|
| 37 |
:param object: optional object to associate the message with; you |
| 38 |
may skip this and just start with the *message* as the first parameter |
| 39 |
:type object: GObject or GBoxed |
| 40 |
:param string message: the warning message to log |
| 41 |
|
| 42 |
.. function:: Log.notice(object, message) |
| 43 |
|
| 44 |
Logs a notice message, like :c:macro:`wp_notice_object` |
| 45 |
|
| 46 |
:param object: optional object to associate the message with; you |
| 47 |
may skip this and just start with the *message* as the first parameter |
| 48 |
:type object: GObject or GBoxed |
| 49 |
:param string message: the normal message to log |
| 50 |
|
| 51 |
.. function:: Log.info(object, message) |
| 52 |
|
| 53 |
Logs a info message, like :c:macro:`wp_info_object` |
| 54 |
|
| 55 |
:param object: optional object to associate the message with; you |
| 56 |
may skip this and just start with the *message* as the first parameter |
| 57 |
:type object: GObject or GBoxed |
| 58 |
:param string message: the info message to log |
| 59 |
|
| 60 |
.. function:: Log.debug(object, message) |
| 61 |
|
| 62 |
Logs a debug message, like :c:macro:`wp_debug_object` |
| 63 |
|
| 64 |
:param object: optional object to associate the message with; you |
| 65 |
may skip this and just start with the *message* as the first parameter |
| 66 |
:type object: GObject or GBoxed |
| 67 |
:param string message: the debug message to log |
| 68 |
|
| 69 |
.. function:: Log.trace(object, message) |
| 70 |
|
| 71 |
Logs a trace message, like :c:macro:`wp_trace_object` |
| 72 |
|
| 73 |
:param object: optional object to associate the message with; you |
| 74 |
may skip this and just start with the *message* as the first parameter |
| 75 |
:type object: GObject or GBoxed |
| 76 |
:param string message: the trace message to log |
| 77 |
|
| 78 |
.. function:: Debug.dump_table(t) |
| 79 |
|
| 80 |
Prints a table with all its contents, recursively, to stdout |
| 81 |
for debugging purposes |
| 82 |
|
| 83 |
:param table t: any table |