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