View previous topic :: View next topic |
Author |
Message |
CrazyCat Owner

Joined: 13 Jan 2002 Posts: 972 Location: France
|
Posted: Tue Oct 04, 2011 9:14 am Post subject: Any way to ignore emails ? |
|
|
Hello there,
I'm looking for a way to modify the logfile generated with eggdrop. I want to replace any email by a string, like <email> (or anything else.
So, I'm looking on the way to create a module overriding the logging system to apply a regexp replace.
But, I can't find out the way actually.
If anyone of you could give me a small help (a start point ?), I think I'll do that soon.
Regards _________________ https://www.eggdrop.fr
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Oct 04, 2011 1:06 pm Post subject: |
|
|
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: | 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 _________________ NML_375, idling at #eggdrop@IrcNET
Last edited by nml375 on Wed Oct 05, 2011 12:31 pm; edited 1 time in total |
|
Back to top |
|
 |
CrazyCat Owner

Joined: 13 Jan 2002 Posts: 972 Location: France
|
Posted: Wed Oct 05, 2011 8:43 am Post subject: |
|
|
Well, this solution is good for me, I didn't notice the bind LOG in 1.6.20.
I'll use it, peharps a new tcl will come soon  _________________ https://www.eggdrop.fr
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|