def init_param(): reload(sys) os.chdir("/var/project/wood_wechat") sys.setdefaultencoding('utf-8') log.init_log() log.log_.info("程序开始运行") Watcher() cfg.loadCfg() tk.post_url() #tk.post_menu() mDB = dataBase.DB() mDB.doNothing() mDB.refresh() mDB.close()
import sys from os.path import abspath, join, dirname sys.path.insert(0, join(abspath(dirname(__file__)), '..')) dirpath = join(abspath(dirname(__file__)), '..') outpath = join(dirpath, 'out') from src.stock import Stock from src.simulate_pool import run_simulate_pool from src.test_strategy_pool import get_strategy_pool from src.log import init_log logging = init_log() stock = Stock() def get_stock_pool(): return [ '600000.SH', '002032.SZ', '600030.SH', '601318.SH', '000001.SZ', '000002.SZ', '600612.SH', '600188.SH', '600340.SH', '600048.SH', '000048.SH', '601966.SH',
sys.path.append('../') from src.conf import setting from src.orm.message_model import MessageModel from src.orm.group_model import GroupModel from src.orm.user_model import UserModel from src.util import util from src.util.util import timestamp2datestring as t2d from src.util.request import RemoteRequest from src.log import init_log app = Flask(__name__) init_log('log/app') @app.route('/', methods=['GET']) def messages(): messages = (MessageModel .select() .where(MessageModel.group_id == '454c1ad2') .where(MessageModel.status == constant.MSG_STATUS_UNAUDIT)) for message in messages: message.type = setting.MSG_TYPES[message.type] message.question = 'Yes' if message.question else 'No' message.create_time = t2d(message.create_time) return render_template('messages.html', messages=messages)
import sys from os.path import abspath, join, dirname sys.path.insert(0, join(abspath(dirname(__file__)), '..')) import src.log as log logging = log.init_log() logging.info("123")
# coding: utf8 import wxpy from src import log from src.conf import setting from src.util.timer import Timer from src.util.dynamic_import import Container from src.tasks.keepAliveTask import KeepAliveTask from src.tasks.syncUserTask import SyncUserTask log.init_log('log/process') timers = [] container = Container.instance() def shutdown(signum, timers): for t in timers: t.stop() # for s in [signal.SIGINT, signal.SIGHUP, signal.SIGTERM, signal.SIGKILL]: # signal.signal(s, functools.partial(shutdown, s, timers)) def login_callback(): pass # bot.file_helper.send_message('Hello')
from src.log import LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR, LOG_CRITICAL from src import log log.init_log('test_slam', log.DEBUG, mode=log.MODE_CONSOLE) LOG_DEBUG('debug') LOG_INFO('info') LOG_WARN('warn') LOG_ERROR('error') LOG_CRITICAL('critical')