Loginfo & Logdetails.

By ReQueST on Jan 31, 2005

Just before people start yelling, it's some sort of double post indeed. But i found this a newer acript, and different from the old one. So i posted it as new.
Explaining: It searches your logdir for the "search-string" (The input what your searching for). It lists how many files and the size. It keeps track of the record size. (This is bascly the old one, but now in dialog.)
New part: The details, and being able to open all the logfiles that matched the search. It opens it in a list. On a single click it shows the deatils about that 1 specific file. And on Double-Click it opens the logfile.
To run this snippet: Copy and paste into a NEW file. Load it, and type: /log
It opens the first dialog.
Have fun.

dialog Loginfo {
  size -1 -1 400 85
  option dbu
  title "Logfile Information."

  box "Search.", 1, 5 3 100 75
  text "Search for:", 2, 10 17 50 10
  edit "", 3, 10 27 83 10, return
  button "[Search]", 4, 15 45 30 10
  button "[Reset]", 5, 55 45 30 10
  button "[Close]", 6, 35 63 30 10

  text "L", 20, 115 3 20 10, disable
  text "O", 21, 115 13 20 10, disable
  text "G", 22, 115 23 20 10, disable
  text "I", 23, 115 33 20 10, disable
  text "N", 24, 115 43 20 10, disable
  text "F", 25, 115 53 20 10, disable
  text "O", 26, 115 63 20 10, disable

  box "Results.", 7, 130 3 260 75
  text "Search-string:", 8, 140 17 50 10
  text "Found:", 9, 140 27 50 10 
  text "Record:", 10, 140 37 50 10
  text "Process Time:", 11, 140 47 50 10
  text "...", 12, 200 17 100 10
  text "...", 13, 200 27 170 10
  text "...", 14, 200 37 170 10
  text "...", 15, 200 47 100 10
  button "[Details]", 16, 220 60 40 10, disable
  button "[Message Channel]", 17, 270 60 50 10, disable
}

alias log { dialog -m Loginfo Loginfo | $iif($exists(tijdelijk.txt),remove -c tijdelijk.txt) }

on *:DIALOG:Loginfo:sclick:4:{ 
  $iif($exists(tijdelijk.txt),remove -c tijdelijk.txt)
  if ($did(3).text) {
    did -a Loginfo 12 $did(3).text 
    set %process.time $ctime
    if ($findfile($logdir,* $+ $did(3).text $+ *,0)) { 
      var %a = $findfile($logdir,* $+ $did(3).text $+ *,0) 
      while (%a) {
        inc %fsize $file($findfile($logdir,* $+ $did(3).text $+ *,%a)).size
        if (%a = 1) { 
          did -a Loginfo 13 $findfile($logdir,* $+ $did(3).text $+ *,0) files, with a total of: $bytes(%fsize,kb3).suf $+ . (Avg: $bytes($calc(%fsize / $findfile($logdir,* $+ $did(3).text $+ *,0)),kb3).suf $+ ) 
          if (!%biggest) { set %biggest 1 $did(3).text }
          if (%fsize >= $gettok(%biggest,1,32)) { 
            set %biggest %fsize $did(3).text
            did -a Loginfo 14 NEW Record size: $iif($bytes($gettok(%biggest,1,32),kb).suf,$bytes($gettok(%biggest,1,32),kb).suf,0) $+ , for $iif($chr(35) != $left($gettok(%biggest,2,32),1),nick:,channel:) $iif($gettok(%biggest,2,32),$gettok(%biggest,2,32),n/a) $+ , in $findfile($logdir,* $+ $gettok(%biggest,2,32) $+ *,0) files.
            did -a Loginfo 15 Process time took: $duration($calc($ctime - %process.time)) $+ .
            did -e Loginfo 16
            did -r Loginfo 3
            did -e Loginfo 17
          }
          else { 
            did -a Loginfo 14 Record size: $iif($bytes($gettok(%biggest,1,32),kb).suf,$bytes($gettok(%biggest,1,32),kb).suf,0) $+ , $iif($left($gettok(%biggest,2,32),1) != $chr(35),nick:,channel:): $iif($gettok(%biggest,2,32),$gettok(%biggest,2,32),n/a) $+ , in $findfile($logdir,* $+ $gettok(%biggest,2,32) $+ *,0) files. 
            did -a Loginfo 15 Process time took: $duration($calc($ctime - %process.time)) $+ .
            did -r Loginfo 3
            did -e Loginfo 16
            did -e Loginfo 17
          }
          unset %fsize 
        }
        write tijdelijk.txt $findfile($logdir,* $+ $did(3).text $+ *,%a)
        dec %a
      }
    }
    else { 
      did -a Loginfo 13 0 files found.
      did -a Loginfo 15 Process time took: $duration($calc($ctime - %process.time)) $+ .
      did -a Loginfo 14 Record size: $iif($bytes($gettok(%biggest,1,32),kb).suf,$bytes($gettok(%biggest,1,32),kb).suf,0) $+ , $iif($left($gettok(%biggest,2,32),1) != $chr(35),nick:,channel:): $iif($gettok(%biggest,2,32),$gettok(%biggest,2,32),n/a) $+ , in $findfile($logdir,* $+ $gettok(%biggest,2,32) $+ *,0) files. 
      did -r Loginfo 3
    }
  }
  else { return }
} 

on *:DIALOG:Loginfo:sclick:5: {
  unset %biggest
  unset %process.time
  did -r Loginfo 12 | did -a Loginfo 12 ...
  did -r Loginfo 13 | did -a Loginfo 13 ...
  did -r Loginfo 14 | did -a Loginfo 14 ...
  did -r Loginfo 15 | did -a Loginfo 15 ...
  did -r Loginfo 3
  $iif($exists(tijdelijk.txt),remove -c tijdelijk.txt)
  echo 12 -agt * Finished the unsetting of local records.
}
on *:DIALOG:Loginfo:sclick:6:{ /dialog -x Loginfo | $iif($exists(tijdelijk.txt),remove -c tijdelijk.txt) }
on *:DIALOG:Loginfo:sclick:16: { dialog -m Logdetails Logdetails | logdetailsCheck }
on *:DIALOG:Loginfo:sclick:17:{ 
  set %channel $?="To wich channel?"
  $iif($left(%channel,1) != $chr(35),set %channel $chr(35) $+ %channel)
  if ($me ison %channel) {
    msg %channel Searching for: $did(12).text
    msg %channel Found: $did(13).text
    msg %channel $did(14).text
    msg %channel $did(15).text
  }
  else { echo 4 -agt * You're not on %channel $+ ! }
}

dialog Logdetails {
  size -1 -1 200 330
  option dbu
  title "Loginfo Details."

  box "Details.", 31, 10 25 180 210
  text "Double click an item in the list to show the file.", 33, 45 7 150 10
  list 32, 15 35 170 200, vsbar hsbar

  text "L - O - G - D - E - T - A - I - L - S", 34, 55 242 100 10, disabled

  box "File Details.", 35, 10 254 180 60
  text "Name:", 36, 20 262 40 10
  text "Size:", 37, 20 272 40 10
  text "Created:", 38, 20 282 40 10
  text "Moderated:", 39, 20 292 40 10
  text "Last access:", 40, 20 302 40 10
  text "...", 41, 70 262 100 10
  text "...", 42, 70 272 100 10
  text "...", 43, 70 282 100 10
  text "...", 44, 70 292 100 10
  text "...", 45, 70 302 100 10

  button "[Close]", 50, 77 317 40 10
}

on *:DIALOG:Logdetails:sclick:50:{ dialog -x Logdetails }
on *:DIALOG:Logdetails:dclick:32:{ 
  run $read(tijdelijk.txt,$did(32).sel) 
}
on *:DIALOG:Logdetails:sclick:32:{
  did -a Logdetails 41 $did(32).seltext
  did -a Logdetails 42 $bytes($file($read(tijdelijk.txt,$did(32).sel)).size,bk3).suf
  did -a Logdetails 43 $duration($calc($ctime - $file($read(tijdelijk.txt,$did(32).sel)).ctime))
  did -a Logdetails 44 $duration($calc($ctime - $file($read(tijdelijk.txt,$did(32).sel)).mtime))
  did -a Logdetails 45 $duration($calc($ctime - $file($read(tijdelijk.txt,$did(32).sel)).atime))
}

alias logdetailsCheck {
  var %a = 1, %b = $lines(tijdelijk.txt)
  while (%a <= %b) {
    did -a Logdetails 32 $nopath($read(tijdelijk.txt,%a))
    inc %a
  }
}

Comments

Sign in to comment.
ReQueST   -  Jan 31, 2005

Last edit: Added a \"msg channel\" function.

 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.