egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to write own lines in logfile ?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Nov 17, 2009 6:32 pm    Post subject: How to write own lines in logfile ? Reply with quote

Hello there,

I'm looking for a way to write, via tcl, lines in the channel log file. My bot receive datas from another one and I want to keep them in my logfile, from a procedure.

I can't use a log flag because I've to treat lines before store them, so any idea ?

Cheers
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Nov 17, 2009 7:44 pm    Post subject: Reply with quote

Have a look at the putloglev tcl command.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Nov 18, 2009 3:30 am    Post subject: Reply with quote

Oh yes, thanks a lot.
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Nov 18, 2009 6:02 am    Post subject: Reply with quote

Oh, really strange bug with my script.

My eggdrop was well loging the channel, and I've added in one of my scripts:
Code:
putloglev p "$chan" "<$user> $text"

And now, my eggdrop doesn't log anything, neither channel activity nor the script activity.

Before I changed the script, I've tried in party-line and it didn't make any trouble:
PartyLine wrote:
.tcl putloglev p "#test" "<CrazyCat> I'm testing"

Channel wrote:
<CrazyCat> I'm testing too

test.log wrote:
[10:04] <CrazyCat> I'm testing
[10:05]<CrazyCat> I'm testing too

And since I've rehash the eggdrop with the modified tcl, no more entries in my log file.

Any idea ?
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Dec 29, 2009 6:31 am    Post subject: Reply with quote

Hello, and sorry to up this thread, but I can't understand the trouble:

I've add a small procedure to do my puloglev:
Code:
proc cr:log { lev chan line } {
   putloglev $lev "$chan" "$line"
   putlog "$line saved"
   return 1
}


This procedure is called at the end of others, and I can see the putlog in party-line, but nothing is added in the logfile, neither the "normal logged things", neither what I want to add in my logfile.

Does the putloglev modify the output destination ? Or am I wrong somewhere ?
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Dec 29, 2009 7:13 pm    Post subject: Reply with quote

Sorry for the late reply.

To my best knowledge, using the putloglev command should not interfere with writing log files, as it never actually touches the files but merely add the message to the list of log entries to be written/displayed.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Tue Dec 29, 2009 7:26 pm    Post subject: Reply with quote

Code:
return 1


http://www.eggheads.org/support/egghtml/1.6.19/tcl-commands.html#bindb

The problem is whatever is calling your "putlog" procedure is invoked by a bind. This isn't a problem, except when you aren't returning something to tcl. As instead, the return value will be the one returned from your "putlog" procedure as I assume it's at then very end of your pubm/msgm procedure, the last command before the procedure ends. For most wildcard binds, those that can use a * within them, a return value of 1 signifies do-not-log/take-no-further-action. You will need to investigate every "return" within your script especially those invoked through binds. Use the url above to check what return values signify to each bind.

Notice how pub and msg use a return of 1 to log. Whilst pubm and msgm do this when returned a 0. It's likely pubm/msgm bindings are your suspect.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Wed Dec 30, 2009 4:00 am    Post subject: Reply with quote

I'd finally found my error (yes, a CKI one): I did rehash to try my changes, but it seems that the eggdrop needs a restart.
Now, it works well and I can log what I need.

@speechles: I've also modified the return 1 to return 0, I don't know if it's really important but it works Smile
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
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


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber