Skip to content

Commit 95fcdbd

Browse files
committed
Removed some unneeded code
1 parent f72925e commit 95fcdbd

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

irclogger/main.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
from optparse import OptionParser
1414
from collections import defaultdict
1515
from socket import error as SocketError
16-
from re import compile as compile_regex
16+
from time import localtime, strftime, time
1717
from datetime import date, datetime, timedelta
1818
from os import environ, getcwd, makedirs, path
19-
from time import asctime, localtime, strftime, time
2019

2120

2221
import circuits
@@ -42,7 +41,7 @@
4241
USAGE = "%prog [options] <host> [<port>]"
4342
VERSION = "%prog v" + __version__
4443

45-
LOGFILE_REGEX = compile_regex("^(.*)\.(.*)\.log$")
44+
4645
PIDFILE = path.join(path.dirname(__file__), "{0:s}.pid".format(__name__))
4746

4847

@@ -100,21 +99,12 @@ def parse_options():
10099
return opts, args
101100

102101

103-
def timestamp():
104-
return asctime(localtime(time()))
105-
106-
107102
def generate_logfile(channel):
108103
return path.join(channel, "{0:s}.log".format(
109104
strftime("%Y-%m-%d", localtime()))
110105
)
111106

112107

113-
def parse_logfile(filename):
114-
match = LOGFILE_REGEX.match(filename)
115-
return match.groups() if match is not None else "", ""
116-
117-
118108
class log(Event):
119109
"""log Event"""
120110

@@ -134,9 +124,7 @@ def init(self, *args, **kwargs):
134124
Timer(interval, rotate(), self.channel).register(self)
135125

136126
def rotate(self):
137-
dirname = path.dirname(self.filename)
138-
filename = path.basename(self.filename)
139-
channel, _ = parse_logfile(filename)
127+
channel = dirname = path.dirname(self.filename)
140128
logfile = generate_logfile(channel)
141129
self.fire(close(), self.channel)
142130
self.fire(open(path.join(dirname, logfile), "a"), self.channel)

0 commit comments

Comments
 (0)