Commit b52d7285 authored by fendouai's avatar fendouai

fix logging

parent 94c3a9d9
......@@ -3,4 +3,4 @@ build/
dist/
jpush.egg-info/
.idea/
jpush.log
\ No newline at end of file
......@@ -5,5 +5,4 @@ _jpush = jpush.JPush(app_key, master_secret)
device = _jpush.create_device()
reg_id = '1507bfd3f7c466c355c'
entity = jpush.device_tag(jpush.add("ddd", "tageee"))
#entity = jpush.device_tag("")
device.set_devicemobile(reg_id, entity)
import jpush as jpush
from jpush import core
from conf import app_key, master_secret
_jpush = jpush.JPush(app_key, master_secret)
push = _jpush.create_push()
push.audience = jpush.all_
push.notification = jpush.notification(alert="Hello, world!")
push.notification = jpush.notification(alert="Hello,python sdk!")
push.platform = jpush.all_
core.logger.debug('logger debug message test')
push.send()
......@@ -9,10 +9,16 @@ from .push import Push
from .device import Device
from .report import Report
from .schedule import Schedule
logger = logging.getLogger('jpush')
logging.basicConfig(level = logging.DEBUG,
format = '%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt = '%a, %d %b %Y %H:%M:%S',
filename = 'log/jpush.log',
filemode = 'w')
class JPush(object):
def __init__(self, key, secret):
self.key = key
self.secret = secret
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment