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.

keep tcl logfile

Old posts that have not been replied to for several years.
Locked
T
TomSommer

keep tcl logfile

Post by TomSommer »

I'm making a new logfile with the tcl command: logfile

logfile <modes> <channel> <filename>

It works great... but when I rehash the bot, the bot has forgotton my logfile? Why :(
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

We would have to see some sort of code, to understand what is happening when.
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

not enough info

Post by spyda »

For what you have said and ppslim looking at the question it looks like you open the log file to write data in it.. when you start the command put somewhere in your tcl so it makes sure that the file is made / if not make the file for you

Code: Select all

set thefile "/home/eggdrop/logs/"

if {![file exists $thefile/logfile.txt]} {
  set newfile [open $thefile/logfile.txt w]
  puts $newfile ""
  close $newfile
}
If you put that at the top of the Tcl file without a proc everytime you .rehash the bot it will check to make sure the file is there.. If not it will make one for you.

Hope that helps

------------
ThePope
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

set thefile "/home/eggdrop/logs/"

if {![file exists $thefile/logfile.txt]} {
set newfile [open $thefile/logfile.txt w]
puts $newfile ""
close $newfile
}
just pointiong out one thing, if u open the file in a+ the file is created if it does not exist...then you don't have to puts $newfile ""
Elen sila lúmenn' omentielvo
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The code you have pastes, would not explain why you are having the problems you are.

We would need to see how you replace it, and pretty much the whole of new log proc.

Normaly, the only overwitting this sort of command will do, is replace itself (if usign rename, so you can call the old script later.)
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

take a better look ppslim ;)
TomSommer has not given us any code yet
Elen sila lúmenn' omentielvo
T
TomSommer

Post by TomSommer »

Hehe, sorry... Had some email problems

I was talking about the tcl command "logfile" not my own proc
logfile [<modes> <channel> <filename>]
Description: creates a new logfile, which will log the modes given for
the channel listed. If no logfile is specified, a list of existing
logfiles will be returned. "*" indicates all channels. You can also
change the modes and channel of an existing logfile with this command.
Entering a blank mode and channel ("") makes the bot stop logging there.
Returns: filename of logfile created, or, if no logfile is specified, a
list of logfiles such as: {mco * eggdrop.log} {jp #lame lame.log}
Module: core
but here it is

Code: Select all

proc new_logfile {handle idx text} {
	set chan [lindex [split $text] 0]
	if {$chan == ""} { putdcc $idx "Usage: +log <channel>"; return 0}
	
	set path "logs/[stripchar $chan].log"
	
	logfile pjk $chan $path
	putlog "Now logging $chan to $path"
}
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

AHH, now I see what you are trying to do.

You type a DCC command, and a new logfile is started. When you do a rehash, this logfile is no longer ologged to, and requires that you type the command again.

This is the way that eggdrop is designed. When the bot loads, it reads the logfile lines along with the rest of the config file. As such, it reads them again on a rehash.

Any logile lines removed means that the logging stops on these.

You will need to do a lot more work to the Tcl, to get what you want.

You would have to write a line to file, including the logfile information.

You could then load this file on rehash, and start logging on these channels.
T
TomSommer

Post by TomSommer »

hmm, yes that's one way to do it...

Thanks for the input, just wanted to see if it could be true that it didn't save the bloody logfile settings :)
Locked