Log Viewer

Platform:  mIRC
Published  Mar 02, 2011
Updated  Sep 09, 2014
This will open a @window listing all your .log files in a side list box. By double clicking the one you will then see what is in it in the main part of the @window. Also by chosing "Stats" in the @window menu it will tell you how many .log files you have. The title of the @window changes to let you know which one you are viewing and for which network.

Original idea and basis from http://www.hawkee.com/snippet/8441/ I edited it a bit and made some modifications and felt I would share it.

Update: Added search feature for Display area and List area. Added a reset feature for Display area and List area.

Update 23May2011: Added ability to delete log files ( send to Recycle Bin ) , fixed a bug and cleaned a bit of the code.

Update 14Jul11: Fixed issue if a person PMing you has a nick of 1 letter/number/symbol.

Update 13Feb12: Fixed issue if channel has "." in the title.

Update 9Sep14: Added ability to sort side list by default , channels only, Query/PM only or @Windows only. The reset feature allows you to reset to any of the mention options.

**Note: This was written on version 6.35
***Note: This was last updated on version 7.32 menu status,channel {
Log Viewer:
.Default: $LogViewer(D)
.Channels: $LogViewer(C)
.Query/PM: $LogViewer(Q)
.@Windows: $LogViewer(@)
}
alias LogViewer {
$iif(!$window(@LogViewer),window -CkSzl20 @LogViewer $mircexe)
dline @LogViewer $+(1-,$line(@LogViewer,0,0))
dline -l @LogViewer $+(1-,$line(@LogViewer,0,1))
renwin @LogViewer @LogViewer $chr(160)
if ($1 = D) { noop $qt($findfile($logdir,*.log,@LogViewer,aline -l @LogViewer $nopath($1-))) }
if ($1 = C) { noop $qt($findfile($logdir,#*.log,@LogViewer,aline -l @LogViewer $nopath($1-))) }
if ($1 = @) { noop $qt($findfile($logdir,@*.log,@LogViewer,aline -l @LogViewer $nopath($1-))) }
if ($1 = Q) {
var %t 1
while (%t <= $findfile($logdir,*.log,0)) {
aline -l @logViewer $nopath($findfile($logdir,*.log,%t)) | inc %t
}
dline -l @LogViewer 1- $+ $calc($fline(@LogViewer,@*,1,1)-1)
dline -l @LogViewer 1- $+ $fline(@LogViewer,@*,0,1)
}
}
menu @LogViewer {
dclick {
if ($sline(@LogViewer,1)) {
renwin @LogViewer @LogViewer $&
- Log File: $gettok($sline(@LogViewer,1),1--3,46) $&
- Network: $gettok($sline(@LogViewer,1),-2,46) $&
- Size: $bytes($file($qt($findfile($logdir,$sline(@LogViewer,1),1))).size).suf
.loadbuf -rip @LogViewer $qt($findfile($logdir, $+ $sline(@LogViewer,1) $+ *,1)) 0
}
}
Delete Log: {
if ($input(Want to delete $sline(@LogViewer,1),uy,Log File Delete)) {
if ($input(Are you sure you want to delete $sline(@LogViewer,1),y,Log File Delete Confirming)) {
.remove -b $qt($+($logdir,$sline(@LogViewer,1)))
noop $input(Moving $sline(@LogViewer,1) to Recycle Bin. $crlf and $crlf Updating @LogViewer to Default view.,ok2,Log File Delete Confirmation)
$LogViewer(D)
}
}
}
Reset:
.Display: { dline @LogViewer $+(1-,$line(@LogViewer,0,0)) | renwin @LogViewer @LogViewer $chr(160) }
.List:
..Default: $LogViewer(D) | noop $input(Reseting @LogViewer to Default view.,ok2,@LogViewer Reset)
..Channels: $LogViewer(C) | noop $input(Reseting @LogViewer to Channel view.,ok2,@LogViewer Reset)
..Query/PM: $LogViewer(Q) | noop $input(Reseting @LogViewer to Query/PM view.,ok2,@LogViewer Reset)
..@Windows: $LogViewer(@) | noop $input(Reseting @LogViewer to @Windows view.,ok2,@LogViewer Reset)
Search:
.Display: { $LogViewerSearch($remove($$?="Search term",$chr(32)),D) }
.List: { $LogViewerSearch($remove($$?="Search term",$chr(32)),L) }
Stats {
dline @LogViewer $+(1-,$line(@LogViewer,0,0)) | renwin @LogViewer @LogViewer $chr(160)
var %Channels $fline(@LogViewer,$chr(35) $+ *,0,1) | var %@Windows $fline(@LogViewer,$chr(64) $+ *,0,1)
var %Others $calc($findfile($logdir,*.log,0) - $calc(%Channels + %@Windows))
echo -a 12[!]4 There are currently 12 $+ %Channels 4Channel log files 12[!]
echo -a 12[!]4 There are currently 12 $+ %@Windows 4@Window log files 12[!]
echo -a 12[!]4 There are currently 12 $+ %Others 4PM/Other log files 12[!]
echo -a 12[!]4 There are currently 12 $+ $findfile($logdir,*.log,0) 4Total log files 12[!]
}
}
alias -l LogViewerSearch {
if ($1 && $isid) {
if ($2 = D) {
window -znk0 @LogViewerSearch $mircexe
filter -wwcpz @LogViewer @LogViewerSearch * $+ $1 $+ *
renwin @LogViewerSearch @LogViewerSearch $&
- Log File: $gettok($sline(@LogViewer,1),1--3,46) $&
- Network: $gettok($sline(@LogViewer,1),-2,46) $&
- Search Term: $1
if ($filtered < 1) {
noop $input(Searched: $qt($1) $crlf Results: 0,ok2,@LogViewer Search Result)
.timer 1 2 window -c @LogViewerSearch
}
}
if ($2 == L) {
filter -wwcpzlL @LogViewer @LogViewer * $+ $1 $+ *
if ($filtered < 1) {
noop $input(Searched: $qt($1) $crlf Results: 0 $crlf and $crlf Updating @LogViewer to Default view.,ok2,@LogViewer Search Result)
$LogViewer(D)
}
}
}
}

Comments

Sign in to comment.
Scakk   -  22 days ago
Update 9Sep14: Added ability to sort side list by default , channels only, Query/PM only or @Windows only. The reset feature allows you to reset to any of the mention options.
 Respond  
RicJames   -  Mar 27, 2012
It only displays the log files in your main logs folder, it ignores all the other folders. Like for example if you sort your logs by network it won't display the contents of those folders.

Also is their a way to make it only display the logs from the network where it's called?
 Respond  
Scakk   -  Feb 13, 2012
Update 13Feb12: Fixed issue if channel has "." in the title.

 Respond  
Scakk   -  Jul 14, 2011
Update 14Jul11: Fixed issue if a person PMing you has a nick of 1 letter/number/symbol.
 Respond  
irchainscriptz   -  May 26, 2011
yeah that would come in handy
 Respond  
Scakk   -  May 25, 2011
Thanks guys. Thinking of adding the ability to rename the Log Files next.
 Respond  
blackvenomm666   -  May 25, 2011
Tested and very nicely done i love it +10+like
 Respond  
irchainscriptz   -  May 25, 2011
yup works well so far no issues. Nice job Scakk



 Respond  
Scakk   -  May 25, 2011
I just tested it by joining a channel ( ##test ) and it worked fine for me.

Maybe it is one of those mIRC bugs that happens for no reason at all except to cause people issues :P
 Respond  
Conscious   -  May 25, 2011
It isn't an error message, it just sometimes displays the wrong log file
 Respond  
Scakk   -  May 25, 2011
When does this error happen? What is the error message?
 Respond  
Conscious   -  May 25, 2011
I'm getting an error of it not displaying the right log file if there's a filename like ##channel.server.log (accidentally joined) which is displayed instead when i click on #channel.server.log
 Respond  
Scakk   -  May 24, 2011
Update 23May2011: Added ability to delete log files ( send to Recycle Bin ) , fixed a bug and cleaned a bit of the code.
 Respond  
Callumlord   -  Mar 26, 2011
Thanks, just what I need!!! Thanks :))))) :))))))))
 Respond  
Scakk   -  Mar 03, 2011
Fixed. Thanks.
 Respond  
Conscious   -  Mar 03, 2011
$input(Searched: $qt($1) $crlf Results: 0,o,@LogViewer Search Result)
should be
noop $input(Searched: $qt($1) $crlf Results: 0,o,@LogViewer Search Result)

Otherwise you get $TRUE Unknown command
 Respond  
Scakk   -  Mar 03, 2011
Update: Added search feature for Display area and List area. Added a reset feature for Display area and List area.

 Respond  
Conscious   -  Mar 02, 2011
I made a search feature to go along with this.
Code
 


Very nice code.
 Respond  
napa182   -  Mar 02, 2011
Good work Scakk, love the updated version of it. 9/10 +like
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.