This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

How to write own lines in logfile ?

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
CrazyCat
Revered One
Posts: 1334
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

How to write own lines in logfile ?

Post by CrazyCat »

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
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Have a look at the putloglev tcl command.
NML_375
User avatar
CrazyCat
Revered One
Posts: 1334
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Oh yes, thanks a lot.
User avatar
CrazyCat
Revered One
Posts: 1334
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Oh, really strange bug with my script.

My eggdrop was well loging the channel, and I've added in one of my scripts:

Code: Select all

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 ?
User avatar
CrazyCat
Revered One
Posts: 1334
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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: Select all

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 ?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

return 1
http://www.eggheads.org/support/egghtml ... 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.
User avatar
CrazyCat
Revered One
Posts: 1334
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

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 :)
Post Reply