In 1.6.20, you could completely replace the logfile writers with tcl-code using the LOG binding. A very rough implementation would be something like this:
Code: Select all
bind log - * myLogWriter
proc myLogWriter {level channel message} {
#Select which file to write the log entry to. This one is based on the channel name.
switch -exact -- [string tolower $channel] {
"#channel1" {set file "channel1"}
"#channel2" {set file "channel2"}
default {set file "eggdrop"}
}
set fileId [open "logs/${file}.log" "APPEND CREAT WRONLY"]
#do regexp's, etc, on message here...
#...
puts $fileId "[strftime {[%d %b %Y - %H:%M]}] $level: $message"
close $fileId
}
It doesn't exactly match eggdrop's logging format, but that could fairly easily be adopted. This could also be re-written to send all log entries to an SQL-database or syslog.
It's not quite what you asked for, but you could implement a similar solution using modules as well. As for the actual logging code, it's mainly located in src/misc.c along with other misc stuff...
edit: Fixed typo in
switch: Should be
-exact, not
--exact