Futurism › object › gate.log
From Botdom Documentation
The gate.log object is a property of the gate object, and is like the gate also a gateway to the world outside, but specified to logs. In this objects, there are several functions that are handy for logging, although most of them are only used internal in the bot, and should not be used by modules.
Contents |
Properties
- gate.log.gate — a link back to the gate object. Is used as
self.gateinternally inside the class that gate.log origins from.
Methods
void gate.log.activity(str ns, str chat[, bool gate])
Writes chat activity in the ns ns with chat message in chat, to the log and to the gate if the bool gate is not False. The default value of gate is True. This method should only be used internally inside the bot as it can be used in modules to spoof chat to logs.
str gate.log.foldertime()
Returns chat log folder name timestamp format determined from the int value config.logorganization, which describes how the chat logs should be organized. The timestamp format returned can be used in the time.strftime method.
s = gate.log.foldertime() # config.logorganization is 0 ("montly") # s is: %Y-%m
tuple gate.log.formatns(str ns)
Formats the ns ns in a folder/filename-friendly format. Returns a tuple with filename and subfolder name. Is used internally for chat logs only.
ns = gate.log.formatns("chat:Botdom") # ns is: ('Botdom', '') ns = gate.log.formatns("@electricnet") # ns is: ('electricnet', 'pchat')
void gate.log.property(str ns, instance property)
Announces the recieval of a property (inputted as the dAmnProperty instance property) in ns to the gate, and writes the property data to the log. This method should only be used internally inside the bot as it can be used in modules to spoof properties to logs.
void gate.log.write(str name, str subfolder, str data)
Writes inputted str data prefixed with a timestamp to a log file with the inputted name (and in the inputted subfolder if it is not ""). The only gate.log method that is recommended for modules.
gate.log.write("scores", "", "** Some guy scored a goal!") # writes to logs/scores.txt # writes: [10:55:00] ** Some guy scored a goal! gate.log.write("kisses", "stb", "** Eek! Person had to kiss otherperson!") # writes to logs/stb/kisses.txt # writes: [10:55:00] ** Eek! Person had to kiss otherperson!

