|
| Author |
Message |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Fri Dec 05, 2003 9:19 pm Post subject: |
|
|
Hey... I was reading through some of the posts, and someone suggested an idea about having command log the program in a text document.
| Quote: | | perl bot.pl > log.txt |
I think that thats a great idea...and it works fine. But is there a way to have command log the events in the file and still display all the events in the command screen?
I want to do this so that I can read the events as they happen, but I also want to backup the file in case there are errors. _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Nate God Like

Joined: 12 Nov 2003 Posts: 553
    
|
Posted: Fri Dec 05, 2003 9:43 pm Post subject: |
|
|
| Doesn't it do it already? |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Fri Dec 05, 2003 10:48 pm Post subject: |
|
|
It does...if you don't put in the command _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Nate God Like

Joined: 12 Nov 2003 Posts: 553
    
|
Posted: Fri Dec 05, 2003 11:15 pm Post subject: |
|
|
| Hm.... I remember having to do that once for an HTTP server I programmed, for it to be able to run Perl scripts online. I thought it printed it to the window... :blink: |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Sat Dec 06, 2003 12:03 am Post subject: |
|
|
print() sends text to STDOUT or STDERR. When you type
| Quote: | | perl bot.pl > log.txt |
you are simply redirecting STDOUT to a file called log.txt.
If you want text to show up in both STDOUT and a text file, you should create a new function, something like debug() that prints the same text to STDOUT and to a text file. In addition, you can have this function check a flag, say $debug, to see if it should print anything to STDOUT. That way, you can easily turn debugging on and off by changing the value of $debug. |
|
| Back to top |
|
 |
Nate God Like

Joined: 12 Nov 2003 Posts: 553
    
|
Posted: Sat Dec 06, 2003 2:21 am Post subject: |
|
|
My idea was just to make a sub, say "sub Echo" or something, that does all your printing. So instead of doing print "message\n"; you do Echo "message\n";
And then sub Echo would print the message to the console, AND write it into a text file. |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Sat Dec 06, 2003 3:55 am Post subject: |
|
|
I already have all my "$victim: $msg" "$screenname: $reply" print to a text file...
...and they do print to the console....but i want everything to be printed to a document...again..once it hits the console....including the commands and errors _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
Mojave Almost An Agent

Joined: 01 Nov 2003 Posts: 1434
 
|
Posted: Sat Dec 06, 2003 5:48 am Post subject: |
|
|
QUOTE(Nate @ Dec 5 2003, 06:21 PM) My idea was just to make a sub, say "sub Echo" or something, that does all your printing. So instead of doing print "message\n"; you do Echo "message\n";
And then sub Echo would print the message to the console, AND write it into a text file. | hehe, and what did you think my debug() was supposed to do? Exactly what you just wrote down. hehe 
Read my post, it's not just there as filler. |