462
462
def mkdir(path, id=None):
463
463
debug("mkdir(\"%s\")" % (path), LOG_DEBUG, id=id)
465
os.makedirs(path, 0770)
466
466
except OSError, (errno, strerror):
467
467
if errno != 17: debug("%s" % sys.exc_value, LOG_ERR)
2168
2168
if childname: debug("Tlogger loop started", LOG_INFO)
2169
while conf["runtime"]["endtime"] == 0 or len(loglines) > 0:
2171
while len(loglines) > 0:
2172
line = loglines.pop(0)
2173
if line == "sighup":
2174
if logfile: logfile.close()
2175
if conf["main"]["logfile"]:
2176
logpath=conf["main"]["logfile"][0:conf["main"]["logfile"].rfind("/")+1]
2177
if not os.path.exists(logpath):
2179
logfile = open(conf["main"]["logfile"], "a")
2180
conf["runtime"]["logtime"] = os.stat(conf["main"]["logfile"])[8]
2182
if logfile: logfile.write(line+"\n")
2183
if conf["main"]["verbose"] == 7:
2187
if logfile: logfile.flush()
2189
if not childname: break
2192
if conf["runtime"]["logtime"] != os.stat(conf["main"]["logfile"])[8] and "sighup" not in loglines:
2193
loglines.append("sighup")
2194
if conf["main"]["logfile"]: conf["runtime"]["logtime"] = os.stat(conf["main"]["logfile"])[8]
2196
if "sighup" not in loglines: loglines.append("sighup")
2170
while conf["runtime"]["endtime"] == 0 or len(loglines) > 0:
2172
while len(loglines) > 0:
2173
line = loglines.pop(0)
2174
if line == "sighup":
2175
if logfile: logfile.close()
2176
if conf["main"]["logfile"]:
2177
logpath=conf["main"]["logfile"][0:conf["main"]["logfile"].rfind("/")+1]
2178
if not os.path.exists(logpath):
2180
logfile = open(conf["main"]["logfile"], "a")
2181
conf["runtime"]["logtime"] = os.stat(conf["main"]["logfile"])[8]
2183
if logfile: logfile.write(line+"\n")
2184
if conf["main"]["verbose"] == 7:
2188
if logfile: logfile.flush()
2190
if not childname: break
2193
if conf["runtime"]["logtime"] != os.stat(conf["main"]["logfile"])[8] and "sighup" not in loglines:
2194
loglines.append("sighup")
2195
if conf["main"]["logfile"]: conf["runtime"]["logtime"] = os.stat(conf["main"]["logfile"])[8]
2197
if "sighup" not in loglines: loglines.append("sighup")
2198
if logfile: logfile.close()
2199
if childname: debug("Logger thread quited", LOG_INFO)
2199
if logfile: logfile.close()
2200
if childname: debug("Logger thread quited", LOG_INFO)
2204
debug("Logger thread quited", LOG_INFO)
2202
2207
## Thread to keep CRC database clean