• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python log.Log类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tools.log.Log的典型用法代码示例。如果您正苦于以下问题:Python Log类的具体用法?Python Log怎么用?Python Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Log类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: put

    def put(self):
        req = ObjectDict(json_decode(self.request.body))
        Log.info("Polymer>>Hotel>>Online>> user:{} req:{}".format(self.current_user, req))
        hotel_mapping_id = req.hotel_mapping_id
        is_online = req.is_online


        hotel_mapping = HotelMapping.get_by_id(self.db, hotel_mapping_id)
        if hotel_mapping and hotel_mapping.status == hotel_mapping.STATUS.valid_complete:
            hotel_mapping = HotelMapping.set_online(self.db, hotel_mapping_id, is_online)
            if hotel_mapping.is_online in [0, -1]:
                RoomTypeMapping.disable_by_provider_hotel_id(self.db, hotel_mapping.provider_hotel_id)

            try:
                redisClient.put('poi_online',hotel_mapping.main_hotel_id)
            except Exception,e:
                traceback.print_exc()
            yield self.notify_stock(hotel_mapping.provider_id, hotel_mapping.provider_hotel_id)
            try:
                module = modules['merge']
                motivation = None
                if is_online in [0, -1]:
                    motivation = motivations['offline_hotel']
                else:
                    motivation = motivations['online_hotel']
                operator = self.current_user
                poi_hotel_id = hotel_mapping.main_hotel_id
                otaId = hotel_mapping.provider_id
                hotelName = hotel_mapping.provider_hotel_name
                hotelModel = Hotel.get_by_id(self.db,id=poi_hotel_id)
                operate_content = hotelName + "<->" + hotelModel.name
                hotel_id = hotel_mapping_id
                PoiOperateLogMapping.record_log(self.db,otaId=otaId,hotelName=hotelName,module=module,motivation=motivation,operator=operator,poi_hotel_id=poi_hotel_id,operate_content=operate_content,hotel_id=hotel_id)
            except Exception,e:
                traceback.print_exc()
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:35,代码来源:polymer.py


示例2: delete

    def delete(self, roomtype_mapping_id):
        Log.info("Second>>RoomType {}>>Delete>> user:{}".format(roomtype_mapping_id, self.current_user))
        mapping = RoomTypeMapping.get_by_id(self.db, roomtype_mapping_id)
        if mapping and mapping.status == mapping.STATUS.wait_second_valid:
            mapping = RoomTypeMapping.revert_to_firstvalid(self.db, roomtype_mapping_id)

            try:
                module = modules['second_valid']
                motivation = motivations['back_roomtype']
                operator = self.current_user
                poi_hotel_id = mapping.main_hotel_id
                poi_roomtype_id = mapping.main_roomtype_id
                otaId = mapping.provider_id
                hotel_id = mapping.provider_hotel_id
                hotelModel = HotelMapping.get_by_provider_and_main_hotel(self.db,otaId,hotel_id,poi_hotel_id)
                hotelName = hotelModel.provider_hotel_name
                roomType = RoomType.get_by_id(self.db,id=poi_roomtype_id)
                operate_content = mapping.provider_roomtype_name + " <-> " + roomType.name

                PoiOperateLogMapping.record_log(self.db,otaId=otaId,hotelName=hotelName,module=module,motivation=motivation,operator=operator,
                                                poi_hotel_id=poi_hotel_id,operate_content=operate_content,hotel_id=hotel_id,poi_roomtype_id=poi_roomtype_id)
            except Exception,e:
                traceback.print_exc()

            self.finish_json(result=ObjectDict(
                roomtype_mapping=mapping.todict(),
                ))
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:27,代码来源:secondvalid.py


示例3: pre_check_order

    def pre_check_order(self, order_entity):

        order = self.create_order(order_entity)
        if not order:
            raise JsonException(1, 'create order fail')

        if order.status != 0:
            return order

        # valid is roomtype online
        roomtype = CooperateRoomTypeModel.get_by_id(self.db, order.roomtype_id)
        if roomtype.is_online != 1:
            Log.info('roomtype is not online')
            order.status = 200
            order.exception_info = 'roomtype is not online'
            self.db.commit()
            OrderHistoryModel.set_order_status_by_server(self.db, order, 0, 200)
            return order

        # valid is inventory enough
        if not self.valid_inventory(order_entity):
            Log.info('more room please')
            order.status = 200
            order.exception_info = 'inventory not enough'
            self.db.commit()

            OrderHistoryModel.set_order_status_by_server(self.db, order, 0, 200)
            return order

        return order
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:30,代码来源:submit_order.py


示例4: send_order_sms

def send_order_sms(self, merchant_id, hotel_name, order_id, confirm_type):
    Log.info(u">>> send sms to merchant {} hotel {} order_id {} confirm type {}".format(merchant_id, hotel_name, order_id, confirm_type))

    order = OrderModel.get_by_id(self.session, order_id)
    breakfast_str = u'含早' if order.get_has_breakfast() else u'无早'
    customers = json.loads(order.customer_info)
    customer_str = " ".join([customer['name'] for customer in customers])


    if confirm_type == OrderModel.CONFIRM_TYPE_AUTO:
        content = u"尊敬的用户您好,系统收到编号{}自动确认订单:{},房型:{},入离日期:{}至{}( {}晚 ),入住人:{},总价:{},{}。订单号:{},请及时关注。客服联系电话:4006103330".format(merchant_id, hotel_name, order.roomtype_name, order.checkin_date, order.checkout_date, order.get_stay_days(), customer_str, order.total_price / 100, breakfast_str, order_id)
    elif confirm_type == OrderModel.CONFIRM_TYPE_MANUAL:
        content = u"尊敬的用户您好,系统收到编号{}待确认订单:{},房型:{},入离日期:{}至{}( {}晚 ),入住人:{},总价:{},{}。订单号:{},请尽快处理。客服联系电话:4006103330".format(merchant_id, hotel_name, order.roomtype_name, order.checkin_date, order.checkout_date, order.get_stay_days(), customer_str, order.total_price / 100, breakfast_str, order_id)
    send_sms_to_service(merchant_id, content)

    user =UserModel.get_user_by_merchantid_username(self.session, merchant_id, 'admin')
    if not user:
        Log.info("send sms no user(order {})".format(order_id))
        return
    phone = user.mobile
    if not phone:
        Log.info("send sms no phone(order {})".format(order_id))
        return

    Log.info(">> send sms to {}".format(phone))
    Log.info(u">> sms content: {}".format(content))
    
    send_sms([phone], content)
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:28,代码来源:sms.py


示例5: generate_html_report

 def generate_html_report(self, report_in_js=True):
     self.generate_report_path()
     reportjs = self.report_path + '/' + 'report.js'
     reporttemplate = self.html_path + '/' + 'report.html'
     reporthtml = self.report_path + '/' + self.dict_all["project"]["name"] + '.html'
     if report_in_js:
         shutil.copy(reporttemplate, reporthtml)
         with open(reportjs, 'w') as f:
             try:
                 d = Log.beautify_json(self.dict_all).encode('utf8').decode('utf8')
                 f.writelines(["report = ", "\n", d, ";", "\n"])
             except UnicodeDecodeError as e:
                 print(e)
     else:
         reporthtml = self.report_path + '/' + self.dict_all["project"]["name"] + '_report.html'
         with open(reporttemplate, 'r') as src, open(reporthtml, 'w') as dst:
             for line in src:
                 if "<script" in line and "src" in line and "report.js" in line:
                     d = Log.beautify_json(self.dict_all)
                     dst.writelines(["<script type='text/javascript' charset='utf-8'>", "\n"])
                     dst.writelines(["var report = ", "\n"])
                     dst.writelines([d.encode("utf8").decode("utf8"), ";", "\n"])
                     dst.writelines(["</script>", "\n"])
                 else:
                     dst.write(line)
     pass
开发者ID:alpha-jacobshih,项目名称:pyjects,代码行数:26,代码来源:efs.py


示例6: put

    def put(self, hotel_mapping_id):
        Log.info("Second>>Hotel {}>>Valid>> user:{}".format(hotel_mapping_id, self.current_user))
        hotel_mapping = HotelMapping.get_by_id(self.db, hotel_mapping_id)
        if hotel_mapping and hotel_mapping.status == hotel_mapping.STATUS.wait_second_valid\
                and hotel_mapping.main_hotel_id != 0:

            hotels = HotelMapping.get_by_chain_id_and_main_hotel_id(self.db, hotel_mapping.provider_id, hotel_mapping.main_hotel_id)
            for hotel in hotels:
                if hotel.id != hotel_mapping.id and hotel.status > hotel_mapping.status:
                    self.finish_json(errcode=402, errmsg=u"已有Hotel{}绑定相同基础酒店".format(hotel.provider_hotel_name))
                    return

            hotel_mapping = HotelMapping.set_secondvalid_complete(self.db, hotel_mapping_id)

            try:
                module = modules['second_valid']
                motivation = motivations['pass_hotel']
                operator = self.current_user
                poi_hotel_id = hotel_mapping.main_hotel_id
                otaId = hotel_mapping.provider_id
                hotelName = hotel_mapping.provider_hotel_name
                hotelModel = Hotel.get_by_id(self.db,id=poi_hotel_id)
                operate_content = hotelName + "<->" + hotelModel.name
                hotel_id = hotel_mapping_id
                PoiOperateLogMapping.record_log(self.db,otaId=otaId,hotelName=hotelName,module=module,motivation=motivation,operator=operator,poi_hotel_id=poi_hotel_id,operate_content=operate_content,hotel_id=hotel_id)
            except Exception,e:
                traceback.print_exc()

            self.finish_json(result=ObjectDict(
                hotel_mapping=hotel_mapping.todict(),
                ))
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:31,代码来源:secondvalid.py


示例7: post

    def post(self):
        args = self.get_json_arguments()
        chain_hotel_id, main_hotel_id, merchant_id, merchant_name = get_and_valid_arguments(args,
                'chain_hotel_id', 'main_hotel_id', 'merchant_id', 'merchant_name')
        hotel = HotelModel.get_by_id(self.db, main_hotel_id)

        hotel_mapping = HotelMappingModel.get_by_provider_hotel(self.db, 6, chain_hotel_id,is_delete=-1)
        if hotel_mapping:
            Log.info(">>> modify exist ebooking hotel {}".format(hotel_mapping.todict()))
            hotel_mapping.merchant_id = merchant_id
            hotel_mapping.merchant_name = merchant_name
            hotel_mapping.info = 'update by ebooking'
            hotel_mapping.status = hotel_mapping.STATUS.valid_complete
            hotel_mapping.city_id = hotel.city_id
            hotel_mapping.provider_hotel_name = hotel.name
            hotel_mapping.provider_hotel_address = hotel.address
            hotel_mapping.main_hotel_id = hotel.id
            hotel_mapping.is_delete = 0
            self.db.commit()
        else:
            hotel_mapping = HotelMappingModel.new_hotel_mapping_from_ebooking(self.db,
                    chain_hotel_id, hotel.name, hotel.address, hotel.city_id, main_hotel_id, merchant_id, merchant_name)

        self.finish_json(result=dict(
            hotel_mapping=hotel_mapping.todict(),
            ))
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:26,代码来源:hotel_mapping.py


示例8: query

    def query(cls, session, name=None, star=None, city_id=None, district_id=None, start=0, limit=10, filter_ids=None, within_ids=None, count_total=True):
        query = session.query(HotelModel)\
                .filter(HotelModel.is_valid == 1)
        if within_ids:
            query = query.filter(HotelModel.id.in_(within_ids))
        if filter_ids:
            query = query.filter(~HotelModel.id.in_(filter_ids))
        if name:
            query = query.filter(HotelModel.name.like(u'%{}%'.format(name)))
        if star:
            query = query.filter(HotelModel.star == star)
        if city_id:
            query = query.filter(HotelModel.city_id == city_id)
        if district_id:
            query = query.filter(HotelModel.district_id == district_id)

        Log.info("=" * 30)
        t0 = time.time()
        r = query.offset(start).limit(limit).all()
        t1 = time.time()
        if count_total:
            total = query.count()
            return r, total
            t2 = time.time()
            Log.info(">>HotelSearch query cost:{} query total cost:{}".format(t1 - t0, t2-t1))
        else:
            return r
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:27,代码来源:hotel.py


示例9: push_hotel_by_id

 def push_hotel_by_id(self, hotel_id):
     Log.info("<<push hotel by id {}>>".format(hotel_id))
     hotel = CooperateHotelModel.get_by_id(self.db, hotel_id, with_delete=True)
     if not hotel:
         Log.info("<<push hotel {}>> error hotel not exist".format(hotel_id))
         raise gen.Return(False)
     r = yield self.push_hotel(hotel)
     raise gen.Return(r)
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:8,代码来源:hotel.py


示例10: fetch_base_hotel_and_roomtypes

 def fetch_base_hotel_and_roomtypes(self, hotel_id):
     url = API['POI'] + "/api/hotel/" + str(hotel_id) + "/roomtype/"
     try:
         r = yield AsyncHTTPClient().fetch(url)
         result = json.loads(r.body)
     except Exception, e:
         Log.exception(e)
         raise gen.Return((None, None))
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:8,代码来源:hotel.py


示例11: _handle_request_exception

 def _handle_request_exception(self, e):
     self.db.rollback()
     if isinstance(e, JsonException):
         Log.error(e.tojson)
         self.finish_json(errcode=e.errcode, errmsg=e.errmsg)
     else:
         Log.error(traceback.format_exc())
         super(BtwBaseHandler, self)._handle_request_exception(e)
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:8,代码来源:base.py


示例12: push_inventory_by_merchant

    def push_inventory_by_merchant(self, merchant_id):
        Log.info(">> push inventories by merchant {}".format(merchant_id))
        roomtypes = CooperateRoomTypeModel.get_by_merchant_id(self.db, merchant_id)

        for roomtype in roomtypes:
            r = yield self.push_by_roomtype(roomtype)
            if not r:
                raise gen.Return(False)
        raise gen.Return(True)
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:9,代码来源:inventory.py


示例13: notify_stock

    def notify_stock(self, chain_id, chain_hotel_id):
        if not IS_PUSH_TO_STOCK:
            raise gen.Return()

        url = '{}/stock2/internal/hotel/update_time?chainId={}&chainHotelId={}'.format(API['STOCK'], chain_id, chain_hotel_id)
        time.sleep(2)
        resp = yield AsyncHTTPClient().fetch(url)
        Log.info(resp.body)
        raise gen.Return()
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:9,代码来源:stockmixin.py


示例14: create_order

    def create_order(self, order_entity):
        order = OrderModel.get_by_main_order_id(self.db, order_entity.id)
        if order:
            # callback 订单已存在
            Log.info('order exist')
            return order

        order = OrderModel.new_order(self.db, order_entity)
        return order
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:9,代码来源:submit_order.py


示例15: put

    def put(self):
        req = ObjectDict(json_decode(self.request.body))
        Log.info("RoomTypeMapping>> user:{}, req:{}".format(self.current_user, req))

        r = RoomTypeMappingModel.update_main_hotel_id(self.db, req.id, req.main_roomtype_id)

        self.finish_json(result=ObjectDict(
                roomtype_mapping=r.todict(),
            ))
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:9,代码来源:room_type_mapping.py


示例16: get_user_permission

 def get_user_permission(self, username):
     url = Login.PERMISSION_URL.format(username)
     Log.info(url)
     resp = yield AsyncHTTPClient().fetch(url)
     Log.info(resp.body)
     r = json.loads(resp.body)
     resources = r['result']['resources']
     permissions = [p['id'] for p in resources]
     print '=' * 10
     print permissions
     raise gen.Return(mapping_permission(permissions))
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:11,代码来源:base.py


示例17: callback_order_server

def callback_order_server(order_id):
    url = API['ORDER'] + '/order/ebooking/update'
    params = {'orderId': order_id, 'msgType': 0, 'success': True,
            'trackId': generate_track_id(order_id)}
    r = requests.post(url, data=params)
    Log.info(r.text)
    if r.status_code == 200:
        j = r.json()
        if j['errcode'] == 0:
            return True
    return False
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:11,代码来源:submit_order.py


示例18: push_roomtype

    def push_roomtype(self, roomtype_id):
        Log.info("<<POI push room mapping {}>> start".format(roomtype_id))

        room = CooperateRoomTypeModel.get_by_id(self.db, roomtype_id)
        if not room:
            Log.error("<<POI push room mapping {}>> no roomtype".format(roomtype_id))
            raise gen.Return(False)

        room_data = self.generate_data(room)
        r = yield self.post_room(room_data)
        raise gen.Return(r)
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:11,代码来源:poi.py


示例19: add_hotels

 def add_hotels(self, hotels):
     hotel_mappings = []
     for hotel in hotels:
         try:
             hotel_mapping = self.add_hotel_mapping(hotel)
             hotel_mappings.append(hotel_mapping)
         except:
             Log.info(">>> push ebooking hotel {} fail !!!".format(hotel))
             Log.error(traceback.format_exc())
             self.db.rollback()
     return hotel_mappings
开发者ID:icyCloud,项目名称:test_p_o_i,代码行数:11,代码来源:hotel_mapping.py


示例20: push_all

    def push_all(self):
        Log.info("<<POI push all>> start")
        if not IS_PUSH_TO_POI:
            return

        from models.merchant import MerchantModel
        merchants = MerchantModel.get_all(self.session)
        for merchant in merchants:
            try:
                self.push_by_merchant(merchant)
            except Exception as e:
                Log.debug(traceback.format_exc())
开发者ID:icyCloud,项目名称:test_e_b_k,代码行数:12,代码来源:poi.py



注:本文中的tools.log.Log类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python glob.load_from_file函数代码示例发布时间:2022-05-27
下一篇:
Python locker.lock函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap