Month Logger Script

By ZabuzaMomochi on Jul 10, 2007

Well, this was a request from a friend. He wanted a script that would put logs files into a certain folder, depending on what month it is. (I.E. If it was the month of July, all log files would be put in a July folder) I haven't had much time to test the script(Made it yesterday) but i think its been done pretty well. Tell me if you find any errors because, as said before, I didn't have much time to test it.

on *:START: {
  if ($readini(logging.ini,logging,logging) == Yes) {
    echo -a Logging script initialized
    if ($readini(Logging.ini,Logging,Logmonth) != $time(mmmm)) { 
      mkdir Mlogs
      echo -a Log for the new month has been created. 
      mkdir MLogs\ $+ $time(mmmm)
      writeini Logging.ini Logging Logmonth $time(mmmm)
    }
  }
}
on *:LOAD: {
  mkdir MLogs
  .timer 1 2 mkdir Mlogs\ $+ $time(mmmm)
  writeini Logging.ini Logging Logmonth $time(mmmm)
}
menu * {
  -
  ...Logging
  ..On:logging on | echo -a Logging initialized
  ..Off:logging off | echo -a Logging turned off
}
alias logging {
  if ($1 == on) {
    writeini Logging.ini Logging Logging Yes
    if ($readini(Logging.ini,Logging,Logmonth) != $time(mmmm)) {  
      mkdir $time(mmmm)
      writeini Logging.ini Logging Logmonth $time(mmmm)
    }
  }
  if ($1 == off) {
    writeini Logging.ini Logging Logging No
  }
}
on *:JOIN:#: {
  if ($nick == $me) && ($readini(logging.ini,logging,logging) == Yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt [New Session start at $fulldate on $network on $chan $+ ]
  }
  if ($nick != $me) && ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt $timestamp ** Joins: $nick
  }
}
on *:OPEN:?: {
  if ($readini(logging.ini,logging,logging) == Yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt [New Session start at $fulldate on $network with $nick $+ ]
  }
}
on *:INPUT:*: {
  if ($1 == /me) { write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $iif($chan != $null,$chan,$nick) $+ . $+ $network $+ .txt $timestamp * $me $1- }
  if (/ == $left($1,1)) { return }  
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $iif($chan != $null,$chan,$active) $+ . $+ $network $+ .txt $timestamp [ $+ $me $+ ]: $1-
  }
}
on *:TEXT:*:*: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $iif($chan != $null,$chan,$nick) $+ . $+ $network $+ .txt $timestamp [ $+ $nick $+ ]: $1-
  }
}
on *:NICK: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt $timestamp ** $nick is now known as $newnick
  }
}
on *:RAWMODE:#: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt $timestamp ** $nick sets mode: $1-
  }
}
on *:ACTION:*:*: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $iif($chan != $null,$chan,$nick) $+ . $+ $network $+ .txt $timestamp * $nick $1-
  }
}
on *:INVITE:#: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt $timestamp * You were invited to join $chan
  }
}
on *:Kick:*: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt $timestamp $knick was kicked by $nick ( $+ $1- $+ )
  }
}
on *:NOTICE:*:*: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $iif($chan != $null,$chan,$nick) $+ . $+ $network $+ .txt $timestamp *** Notice from $nick $+ : $1-
  }
}
on *:QUIT: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt $timestamp *** $nick has quit IRC ( $+ $1- $+ )
  }
}
on *:PART:#: {
  if ($readini(logging.ini,logging,logging) == yes) {
    write Mlogs\ $+ $readini(Logging.ini,Logging,Logmonth) $+ \ $+ $chan $+ . $+ $network $+ .txt $timestamp *** $nick has left $chan ( $+ $iif($1- != $null,$1-,No Reason) $+ )
  }
}

Comments

Sign in to comment.
ZabuzaMomochi   -  Jul 10, 2007

I changed changed it a bit, instead of variables it uses ini files, just incase someone accidently erases a variable and doesnt know what to put, ill just have it use inis.

 Respond  
Olliegod   -  Jul 10, 2007

As far as I know it will interpret the mlogs\ $+ %logmonth etc. as different parameters and won\'t function correctly.

 Respond  
xDaeMoN   -  Jul 10, 2007

@ Olliegod: The first code you posted does the same as the second code. The only difference is the 2nd code doesn\'t use too many \"$+\". Other than that, the 1st one should work fine.

 Respond  
Olliegod   -  Jul 10, 2007

It wont work with the file names in the /write\'s as you have them. Instead of:

 write Mlogs\\ $+ %logmonth $+ \\ $+ $chan $+ . $+ $network $+ .txt [New Session start at $fulldate on $network on $chan $+ ] 

it should be:

 write $+(Mlogs\\,%logmonth,\\,$chan,.,$network,.txt) [New Session start at $fulldate on $network on $chan $+ ] 
 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.