mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
setup config for log precision
This commit is contained in:
parent
7fe614587a
commit
52381e0bcd
@ -5,12 +5,14 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
||||
from sopel.cli.run import build_parser, get_configuration
|
||||
|
||||
import sys
|
||||
import os
|
||||
import configparser
|
||||
|
||||
|
||||
class BotConfig():
|
||||
|
||||
def __init__(self):
|
||||
|
||||
self.dict = {}
|
||||
|
||||
# Load config
|
||||
@ -22,8 +24,13 @@ class BotConfig():
|
||||
opts = parser.parse_args(argv)
|
||||
self.config = get_configuration(opts)
|
||||
|
||||
# Filename
|
||||
self.filename = self.config.filename
|
||||
self.config.basename = os.path.basename(self.config.filename).rsplit('.', 1)[0]
|
||||
self.config.core.logs_stdio = os.path.join(self.config.core.logdir, 'stdio.log')
|
||||
# self.config.core.logs_stdio = os.path.os.path.join(self.config.core.logdir, self.config.basename + '.stdio.log')
|
||||
self.config.core.logs_exceptions = os.path.join(self.config.core.logdir, 'exceptions.log')
|
||||
# self.config.core.logs_exceptions = os.path.os.path.join(self.config.core.logdir, self.config.basename + '.exceptions.log')
|
||||
self.config.core.logs_raw = os.path.join(self.config.core.logdir, 'raw.log')
|
||||
# self.config.core.logs_raw = os.path.os.path.join(self.config.core.logdir, self.config.basename + '.raw.log')
|
||||
|
||||
# load as dict
|
||||
config = configparser.ConfigParser()
|
||||
|
||||
@ -57,11 +57,9 @@ class BotLogs():
|
||||
for logtype in self.dict["list"].keys():
|
||||
stdio_ignore.append("[" + logtype + "]")
|
||||
|
||||
logfile = os.path.os.path.join(botconfig.logdir, 'stdio.log')
|
||||
|
||||
try:
|
||||
log_file_lines = []
|
||||
log_file = open(logfile, 'r')
|
||||
log_file = open(botconfig.logs_stdio, 'r')
|
||||
lines = log_file.readlines()
|
||||
for line in lines:
|
||||
log_file_lines.append(line)
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||
"""Setup for SpiceBot"""
|
||||
|
||||
import os
|
||||
|
||||
from .Logs import logs
|
||||
|
||||
from .Channels import SpiceBot_Channels_MainSection
|
||||
@ -9,5 +11,16 @@ from .Channels import SpiceBot_Channels_MainSection
|
||||
|
||||
def setup(bot):
|
||||
|
||||
logs.log('SpiceBot_Config', "Setting Up Configuration")
|
||||
bot.config.core.basename = os.path.basename(bot.config.filename).rsplit('.', 1)[0]
|
||||
bot.config.core.logs_stdio = os.path.join(bot.config.core.logdir, 'stdio.log')
|
||||
# bot.config.core.logs_stdio = os.path.os.path.join(bot.config.core.logdir, bot.config.basename + '.stdio.log')
|
||||
bot.config.core.logs_exceptions = os.path.join(bot.config.core.logdir, 'exceptions.log')
|
||||
# bot.config.core.logs_exceptions = os.path.os.path.join(bot.config.core.logdir, bot.config.basename + '.exceptions.log')
|
||||
bot.config.core.logs_raw = os.path.join(bot.config.core.logdir, 'raw.log')
|
||||
# bot.config.core.logs_raw = os.path.os.path.join(bot.config.core.logdir, bot.config.basename + '.raw.log')
|
||||
|
||||
# logs.log('SpiceBot_Logs', "Setting Up Configuration")
|
||||
|
||||
logs.log('SpiceBot_Channels', "Setting Up Configuration")
|
||||
bot.config.define_section("SpiceBot_Channels", SpiceBot_Channels_MainSection, validate=False)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user