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)
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
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.

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)
LoggingConsole:getFileName()
Returns the filename for the logfile for this console
LoggingConsole:setFileName(fileName)
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)
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

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)
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)
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)
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)
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)
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)
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)
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)
Append copy()ed text to the console

Parameters:

  • log should we log this?
LoggingConsole:append(log)
Append copy()ed text to the console

Parameters:

  • log should we log this?
LoggingConsole:echo(str, log)
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)
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)
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)
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)
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
generated by LDoc 1.4.6 Last updated 2021-08-31 18:42:52