當前位置: 首頁>>代碼示例>>Python>>正文


Python Log.info方法代碼示例

本文整理匯總了Python中tools.log.Log.info方法的典型用法代碼示例。如果您正苦於以下問題:Python Log.info方法的具體用法?Python Log.info怎麽用?Python Log.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tools.log.Log的用法示例。


在下文中一共展示了Log.info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: put

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:37,代碼來源:polymer.py

示例2: put

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:33,代碼來源:secondvalid.py

示例3: query

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:29,代碼來源:hotel.py

示例4: delete

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:29,代碼來源:secondvalid.py

示例5: send_order_sms

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
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,代碼行數:30,代碼來源:sms.py

示例6: pre_check_order

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:32,代碼來源:submit_order.py

示例7: post

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:28,代碼來源:hotel_mapping.py

示例8: push_hotel_by_id

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
 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,代碼行數:10,代碼來源:hotel.py

示例9: put

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:11,代碼來源:room_type_mapping.py

示例10: create_order

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:11,代碼來源:submit_order.py

示例11: notify_stock

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:11,代碼來源:stockmixin.py

示例12: push_inventory_by_merchant

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:11,代碼來源:inventory.py

示例13: push_roomtype

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
    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,代碼行數:13,代碼來源:poi.py

示例14: post_hotel

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
 def post_hotel(self, hotel_data):
     Log.info(u"<<POI push hotel mapping>> push request {}".format(hotel_data))
     url = API['POI'] + '/api/push/ebooking/hotel/'
     body = json.dumps(hotel_data)
     try:
         r = yield AsyncHTTPClient().fetch(url, method='POST', headers={"Content-Type": "application/json"}, body=body)
         Log.info("<<POI push hotel mapping>> response {}".format(r.body))
         resp = json.loads(r.body)
     except Exception, e:
         Log.exception(e)
         raise gen.Return(False)
開發者ID:icyCloud,項目名稱:test_e_b_k,代碼行數:13,代碼來源:poi.py

示例15: callback_order_server

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import info [as 別名]
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,代碼行數:13,代碼來源:submit_order.py


注:本文中的tools.log.Log.info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。