Skip to content

Commit

Permalink
Trying to fix log rotation. (See Issue #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
prologic committed Apr 17, 2015
1 parent b78288a commit f8574b7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions irclogger/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 129,12 @@ def init(self, *args, **kwargs):
Timer(interval, rotate(), self.channel).register(self)

def rotate(self):
channel = path.dirname(self.filename)
dirname = path.dirname(channel)
channel_dir = path.dirname(self.filename)
output_dir = path.dirname(channel_dir)
channel = path.basename(channel_dir)
logfile = generate_logfile(channel)
self.fire(close(), self.channel)
self.fire(open(path.join(dirname, logfile), "a"), self.channel)

print("Log rotated")
self.fire(open(path.join(output_dir, logfile), "a"), self.channel)

interval = datetime.fromordinal((
date.today() timedelta(1)
Expand Down

0 comments on commit f8574b7

Please sign in to comment.