mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-12 12:12:04 +08:00
path hacking for logging.cfg
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Factory functions to prepare useful data for tests.
|
Factory functions to prepare useful data for tests.
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
import pytz
|
import pytz
|
||||||
import msgpack
|
import msgpack
|
||||||
import random
|
import random
|
||||||
@@ -21,6 +21,11 @@ def data_path():
|
|||||||
data_path = dirname(abspath(data.__file__))
|
data_path = dirname(abspath(data.__file__))
|
||||||
return data_path
|
return data_path
|
||||||
|
|
||||||
|
def logger_path():
|
||||||
|
import zipline
|
||||||
|
log_path = dirname(abspath(zipline.__file__))
|
||||||
|
return os.join(log_path, 'logging.cfg')
|
||||||
|
|
||||||
def load_market_data():
|
def load_market_data():
|
||||||
fp_bm = open(join(data_path(), "benchmark.msgpack"), "rb")
|
fp_bm = open(join(data_path(), "benchmark.msgpack"), "rb")
|
||||||
bm_list = msgpack.loads(fp_bm.read())
|
bm_list = msgpack.loads(fp_bm.read())
|
||||||
|
|||||||
@@ -5,9 +5,15 @@ and other common operations.
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
|
from os.path import join, abspath, dirname
|
||||||
|
|
||||||
def configure_logging():
|
def configure_logging():
|
||||||
logging.config.fileConfig(
|
logging.config.fileConfig(
|
||||||
'logging.cfg',
|
logger_path(),
|
||||||
disable_existing_loggers = False
|
disable_existing_loggers = False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def logger_path():
|
||||||
|
import zipline
|
||||||
|
log_path = dirname(abspath(zipline.__file__))
|
||||||
|
return join(log_path, 'logging.cfg')
|
||||||
|
|||||||
Reference in New Issue
Block a user