Class LoggingConsole
MiniConsole with logging capabilities
Info:
- Copyright: 2020 Damian Monogue
- License: MIT, see LICENSE.lua
- Author: Damian Monogue
Methods
loggingconsole:new(cons, container) | Creates and returns a new LoggingConsole. |
loggingconsole:getExtension() | Returns the file extension of the logfile this console will log to |
loggingconsole:getPath() | Returns the path to the logfile for this console |
loggingconsole:setPath(path) | Sets the path to use for the log file. |
loggingconsole:getFileName() | Returns the filename for the logfile for this console |
loggingconsole:setFileName(fileName) | Sets the fileName to use for the log file. |
loggingconsole:getFullFilename() | Returns the pull path and filename for the logfile for this console |
loggingconsole:enableLogging() | Turns logging for this console on |
loggingconsole:disableLogging() | Turns logging for this console off |
loggingconsole:cechoLink(text, command, hint, log) | cechoLink for LoggingConsole |
loggingconsole:dechoLink(text, command, hint, log) | dechoLink for LoggingConsole |
loggingconsole:hechoLink(text, command, hint, log) | hechoLink for LoggingConsole |
loggingconsole:echoLink(text, command, hint, useCurrentFormat, log) | echoLink for LoggingConsole |
loggingconsole:cechoPopup(text, commands, hints, log) | cechoPopup for LoggingConsole |
loggingconsole:dechoPopup(text, commands, hints, log) | dechoPopup for LoggingConsole |
loggingconsole:hechoPopup(text, commands, hints, log) | hechoPopup for LoggingConsole |
loggingconsole:echoPopup(text, commands, hints, useCurrentFormat, log) | echoPopup for LoggingConsole |
loggingconsole:appendBuffer(log) | Append copy()ed text to the console |
loggingconsole:append(log) | Append copy()ed text to the console |
loggingconsole:echo(str, log) | echo's a string to the console. |
loggingconsole:hecho(str, log) | hecho's a string to the console. |
loggingconsole:decho(str, log) | decho's a string to the console. |
loggingconsole:cecho(str, log) | cecho's a string to the console. |
loggingconsole:replay(numberOfLines) | Replays the last X lines from the console's log file, if it exists |
Methods
- loggingconsole:new(cons, container) line 56
-
Creates and returns a new LoggingConsole.
Parameters:
- cons
table of constraints. Includes all the valid Geyser.MiniConsole constraints, plus
option name description default log Should the miniconsole be logging? true logFormat "h" for html, "t" for plaintext, "l" for log (with ansi) h path The path the file lives in. It is templated.
|h is replaced by the profile homedir.
|y by 4 digit year.
|m by 2 digit month
|d by 2 digit day
|n by the name constraint
|e by the file extension (html for h logType, log for others)"|h/log/consoleLogs/|y/|m/|d/" fileName The name of the log file. It is templated, same as path above "|n.|e" - container the container for the console
Usage:
local LoggingConsole = require("MDK.loggingconsole") myLoggingConsole = LoggingConsole:new({ name = "my logging console", x = 0, y = 0, height = 200, width = 400, }) -- just like making a miniconsole, really
- cons
table of constraints. Includes all the valid Geyser.MiniConsole constraints, plus
- loggingconsole:getExtension() line 67
- Returns the file extension of the logfile this console will log to
- loggingconsole:getPath() line 95
- Returns the path to the logfile for this console
- loggingconsole:setPath(path) line 105
-
Sets the path to use for the log file.
Parameters:
- path
the path to put the log file in. It is templated.
|h is replaced by the profile homedir.
|y by 4 digit year.
|m by 2 digit month
|d by 2 digit day
|n by the name constraint
|e by the file extension (html for h logType, log for others)
- path
the path to put the log file in. It is templated.
- loggingconsole:getFileName() line 110
- Returns the filename for the logfile for this console
- loggingconsole:setFileName(fileName) line 118
-
Sets the fileName to use for the log file.
Parameters:
- fileName
the fileName to use for the logfile. It is templated.
|h is replaced by the profile homedir.
|y by 4 digit year.
|m by 2 digit month
|d by 2 digit day
|n by the name constraint
|e by the file extension (html for h logType, log for others)
- fileName
the fileName to use for the logfile. It is templated.
- loggingconsole:getFullFilename() line 123
- Returns the pull path and filename for the logfile for this console
- loggingconsole:enableLogging() line 132
- Turns logging for this console on
- loggingconsole:disableLogging() line 137
- Turns logging for this console off
- loggingconsole:cechoLink(text, command, hint, log) line 309
-
cechoLink for LoggingConsole
Parameters:
- text the text to use for the link
- command the command to send when the link is clicked, as text. IE [[send("sleep")]]
- hint A tooltip which is displayed when the mouse is over the link
- log Should we log this line? Defaults to self.log if not passed.
- loggingconsole:dechoLink(text, command, hint, log) line 318
-
dechoLink for LoggingConsole
Parameters:
- text the text to use for the link
- command the command to send when the link is clicked, as text. IE [[send("sleep")]]
- hint A tooltip which is displayed when the mouse is over the link
- log Should we log this line? Defaults to self.log if not passed.
- loggingconsole:hechoLink(text, command, hint, log) line 327
-
hechoLink for LoggingConsole
Parameters:
- text the text to use for the link
- command the command to send when the link is clicked, as text. IE [[send("sleep")]]
- hint A tooltip which is displayed when the mouse is over the link
- log Should we log this line? Defaults to self.log if not passed.
- loggingconsole:echoLink(text, command, hint, useCurrentFormat, log) line 340
-
echoLink for LoggingConsole
Parameters:
- text the text to use for the link
- command the command to send when the link is clicked, as text. IE [[send("sleep")]]
- hint A tooltip which is displayed when the mouse is over the link
- useCurrentFormat If set to true, will look like the text around it. If false it will be blue and underline.
- log Should we log this line? Defaults to self.log if not passed. If you want to pass this you must pass in useCurrentFormat
Usage:
myLoggingConsole:echoLink("This is a link!", [[send("sleep")]], "sleep") -- text "This is a link" will send("sleep") when clicked and be blue w/ underline. Defaut log behaviour (self.log)
myLoggingConsole:echoLink("This is a link!", [[send("sleep")]], "sleep", false, false) -- same as above, but forces it not to log regardless of self.log setting
myLoggingConsole:echoLink("This is a link!", [[send("sleep")]], "sleep", true, true) -- same as above, but forces it to log regardless of self.log setting and the text will look like anything else echoed to the console.
- loggingconsole:cechoPopup(text, commands, hints, log) line 349
-
cechoPopup for LoggingConsole
Parameters:
- text the text to use for the link
- commands the commands to send when the popup is activated, as table. IE {[[send("sleep")]], [[send("stand")]]}
- hints A tooltip which is displayed when the mouse is over the link. IE {{"sleep", "stand"}}
- log Should we log this line? Defaults to self.log if not passed.
- loggingconsole:dechoPopup(text, commands, hints, log) line 358
-
dechoPopup for LoggingConsole
Parameters:
- text the text to use for the link
- commands the commands to send when the popup is activated, as table. IE {[[send("sleep")]], [[send("stand")]]}
- hints A tooltip which is displayed when the mouse is over the link. IE {{"sleep", "stand"}}
- log Should we log this line? Defaults to self.log if not passed.
- loggingconsole:hechoPopup(text, commands, hints, log) line 367
-
hechoPopup for LoggingConsole
Parameters:
- text the text to use for the link
- commands the commands to send when the popup is activated, as table. IE {[[send("sleep")]], [[send("stand")]]}
- hints A tooltip which is displayed when the mouse is over the link. IE {{"sleep", "stand"}}
- log Should we log this line? Defaults to self.log if not passed.
- loggingconsole:echoPopup(text, commands, hints, useCurrentFormat, log) line 380
-
echoPopup for LoggingConsole
Parameters:
- text the text to use for the link
- commands the commands to send when the popup is activated, as table. IE {[[send("sleep")]], [[send("stand")]]}
- hints A tooltip which is displayed when the mouse is over the link. IE {{"sleep", "stand"}}
- useCurrentFormat If set to true, will look like the text around it. If false it will be blue and underline.
- log Should we log this line? Defaults to self.log if not passed. If you want to pass this you must pass in useCurrentFormat
Usage:
myLoggingConsole:echoPopup("This is a link!", {[[send("sleep")]], [[send("stand")]], {"sleep", "stand"}) -- text "This is a link" will send("sleep") when clicked and be blue w/ underline. Defaut log behaviour (self.log)
myLoggingConsole:echoPopup("This is a link!", {[[send("sleep")]], [[send("stand")]], {"sleep", "stand"}, false, false) -- same as above, but forces it not to log regardless of self.log setting
myLoggingConsole:echoPopup("This is a link!", {[[send("sleep")]], [[send("stand")]], {"sleep", "stand"}, true, true) -- same as above, but forces it to log regardless of self.log setting and the text will look like anything else echoed to the console.
- loggingconsole:appendBuffer(log) line 386
-
Append copy()ed text to the console
Parameters:
- log should we log this?
- loggingconsole:append(log) line 392
-
Append copy()ed text to the console
Parameters:
- log should we log this?
- loggingconsole:echo(str, log) line 399
-
echo's a string to the console.
Parameters:
- str the string to echo
- log should this be logged? Used to override the .log constraint
- loggingconsole:hecho(str, log) line 406
-
hecho's a string to the console.
Parameters:
- str the string to hecho
- log should this be logged? Used to override the .log constraint
- loggingconsole:decho(str, log) line 413
-
decho's a string to the console.
Parameters:
- str the string to decho
- log should this be logged? Used to override the .log constraint
- loggingconsole:cecho(str, log) line 420
-
cecho's a string to the console.
Parameters:
- str the string to cecho
- log should this be logged? Used to override the .log constraint
- loggingconsole:replay(numberOfLines) line 426
-
Replays the last X lines from the console's log file, if it exists
Parameters:
- numberOfLines The number of lines to replay from the end of the file