SUNiNET - Your Eggdrop & TCL resources site
[ Home Eggdrop TCL Links About ]

Guide to TCL scripting for Eggdrop 1.6

[ Previous ] [ Index ] [ Next ]

6.1 Logging

There are four commands with which you can make Eggdrop log something.
These commands are putlog, putcmdlog, putxferlog and putloglev.
The difference between these commands is that each command sends the log message to a different log level (the various log levels are described in the Eggdrop configfile). Here is a list of the log levels according to eggdrop.complete.conf of Eggdrop 1.6.8:

# Events are logged by certain categories. This way, you can specify
# exactly what kind of events you want sent to various logfiles.
# The most common log file flags are:
#   m  private msgs/ctcps to the bot
#   k  kicks, bans, mode changes on the channel
#   j  joins, parts, netsplits on the channel
#   p  public chatter on the channel
#   s  server connects/disconnects/notices
#   b  information about bot linking and userfile sharing
#   c  commands people use (via msg or dcc)
#   x  file transfers and file-area commands
#      r  (if use-console-r enabled) EVERYTHING sent to the bot by the server
#   o  other: misc info, errors -- IMPORTANT STUFF
#   w  wallops: msgs between IRCops (be sure to set the bot +w in init-server)
# There are others, but you probably shouldn't log them, it'd be rather
# unethical. ;) There are also eight user-defined levels (1-8) which
# are used by Tcl scripts.

The putlog command sends the log message to level o, the putcmdlog command sends the log message to level c, the putxferlog command sends the log message to level x and the putloglev command sends the log message to the level you specify.

The syntax of a putlog, putcmdlog or putxferlog command is putlog "<text>".
The syntax of a putloglev command is putloglev <level(s)> <channel> "<text>".

The <level(s)> is to which log level(s) you want to send the log message.
You can use * to send the log message to all the log levels.

The <channel> is to the log file of which channel you want to send the log message.
Use * to send the log message to the general log.

The <text> is the message you want to log.

The default console modes make masters and owners see all messages sent to the log level o in the partyline.
Because of that putlog is the mostly used log command and you can be pretty sure that the output of it is shown to masters and owners in the partyline which is good because this way you can make your script send out notices of events throughout the partyline for masters and owners.
You can also use this for debugging (finding out where something went wrong). If you place "waypoints" in your script by putting a putlog command every couple of lines in your script that sends a message like "Waypoint X" to the log you can easily see in the partyline where your script goes wrong when it doesn't do something the way you want it do it. Without these "waypoints" it can take a lot longer before you pinpoint the location of the fault.

[ Previous ] [ Index ] [ Next ]

Design & Graphics by Shawn Borton
Copyright © 2000-2005 Marijn van Zon