log.getLoggers: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page Log.getLoggers to log.getLoggers: Converting page titles to lowercase)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
log.getLoggers()
log.getLoggers()
</source>
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
None.
None.
Line 15: Line 15:
|example=
|example=
Get a list of available loggers and format the JSON result.
Get a list of available loggers and format the JSON result.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
<pre>[r: json.indent(log.getLoggers())]</pre>
<pre>[r: json.indent(log.getLoggers())]</pre>
</source>
</syntaxhighlight>
Returns:
Returns:
<source lang="javascript" line>
<syntaxhighlight lang="javascript" line>


[
[
Line 36: Line 36:
     ...
     ...
]
]
</source>
</syntaxhighlight>


|also=
|also=

Latest revision as of 23:59, 15 March 2023

exampleFunction() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.5.2
Returns a JSON array of available loggers and the current logging level for each.

Usage

log.getLoggers()

Parameters None.

Example

Get a list of available loggers and format the JSON result.
<pre>[r: json.indent(log.getLoggers())]</pre>

Returns:

[
        {
        "name": "macro-logger",
        "level": "ERROR"
    },
        {
        "name": "net.rptools.lib.io.PackedFile",
        "level": "ERROR"
    },
        {
        "name": "net.rptools.maptool.client.swing.AbeillePanel",
        "level": "ERROR"
    },
    ...
]

See Also