本文整理汇总了Python中msg.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_info
def get_info(workspace_url, project_dir):
repo_type = detect_type(project_dir)
if not repo_type:
return
msg.debug('Detected ', repo_type, ' repo in ', project_dir)
data = {
'type': repo_type,
}
cmd = REPO_MAPPING[repo_type]['cmd']
try:
p = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=project_dir)
result = p.communicate()
repo_url = result[0].decode('utf-8').strip()
if repo_type == 'svn':
repo_url = parse_svn_xml(repo_url)
msg.log(repo_type, ' url is ', repo_url)
if not repo_url:
msg.error('Error getting ', repo_type, ' url:', result[1])
return
except Exception as e:
msg.error('Error getting ', repo_type, ' url:', str_e(e))
return
data['url'] = repo_url
return data
开发者ID:Floobits,项目名称:floobits-emacs,代码行数:28,代码来源:repo.py
示例2: redraw
def redraw(self) :
if self.sem_obj != None:
self.thread_lock.acquire()
try :
try :
self.sem_obj.P()
try :
shm_obj = self.shm_obj
size = struct.unpack_from("i", shm_obj.read(4,4*0))[0]
x = struct.unpack_from("i", shm_obj.read(4,4*1))[0]
y = struct.unpack_from("i", shm_obj.read(4,4*2))[0]
width = struct.unpack_from("i", shm_obj.read(4,4*3))[0]
height = struct.unpack_from("i", shm_obj.read(4,4*4))[0]
pixbufloader = gtk.gdk.PixbufLoader()
pixbufloader.write(shm_obj.read(size,4*5))
pixbufloader.close()
pixbuf = pixbufloader.get_pixbuf()
finally :
self.sem_obj.V()
pass
pixbuf.copy_area(0, 0, pixbuf.get_width(), pixbuf.get_height(), self.pixbuf, x, y)
self.rectangle = (x,y,width,height)
self.win.queue_draw_area(x,y, pixbuf.get_width(), pixbuf.get_height())
except TypeError:
msg.log("unexpected error:" + str(sys.exc_info()[0]))
pass
except :
msg.log("unexpected general error:" + str(sys.exc_info()))
pass
finally:
self.thread_lock.release()
pass
开发者ID:UCSD-PL,项目名称:kraken,代码行数:35,代码来源:screen.py
示例3: delete_buf
def delete_buf(self, path):
"""deletes a path"""
if not path:
return
path = utils.get_full_path(path)
if not self.is_shared(path):
msg.error("Skipping deleting %s because it is not in shared path %s." % (path, G.PROJECT_PATH))
return
if os.path.isdir(path):
for dirpath, dirnames, filenames in os.walk(path):
# Don't care about hidden stuff
dirnames[:] = [d for d in dirnames if d[0] != "."]
for f in filenames:
f_path = os.path.join(dirpath, f)
if f[0] == ".":
msg.log("Not deleting buf for hidden file %s" % f_path)
else:
self.delete_buf(f_path)
return
buf_to_delete = None
rel_path = utils.to_rel_path(path)
for buf_id, buf in self.FLOO_BUFS.items():
if rel_path == buf["path"]:
buf_to_delete = buf
break
if buf_to_delete is None:
msg.error("%s is not in this room" % path)
return
msg.log("deleting buffer ", rel_path)
event = {"name": "delete_buf", "id": buf_to_delete["id"]}
self.agent.put(event)
开发者ID:rdgmatos,项目名称:dot,代码行数:35,代码来源:protocol.py
示例4: __init__
def __init__(self, parent, path):
self.parent = parent
self.size = 0
self.children = []
self.files = []
self.ignores = {
'/TOO_BIG/': []
}
self.path = utils.unfuck_path(path)
try:
paths = os.listdir(self.path)
except OSError as e:
if e.errno != errno.ENOTDIR:
raise
self.path = os.path.dirname(self.path)
self.add_file(os.path.basename(path))
return
except Exception as e:
msg.error('Error listing path %s: %s' % (path, unicode(e)))
return
msg.log('Initializing ignores for %s' % path)
for ignore_file in IGNORE_FILES:
try:
self.load(ignore_file)
except:
pass
for p in paths:
self.add_file(p)
开发者ID:bobfirestone,项目名称:Bobs-.emacs.d,代码行数:31,代码来源:ignore.py
示例5: save_floorc_json
def save_floorc_json(s):
floorc_json = {}
for k, v in s.items():
floorc_json[k.lower()] = v
msg.log('Writing ', floorc_json)
with open(G.FLOORC_JSON_PATH, 'w') as fd:
fd.write(json.dumps(floorc_json, indent=4, sort_keys=True))
开发者ID:AlexBaranosky,项目名称:EmacsV2,代码行数:7,代码来源:utils.py
示例6: send_error
def send_error(description=None, exception=None):
G.ERROR_COUNT += 1
if G.ERRORS_SENT >= G.MAX_ERROR_REPORTS:
msg.warn('Already sent %s errors this session. Not sending any more.' % G.ERRORS_SENT)
return
data = {
'jsondump': {
'error_count': G.ERROR_COUNT
},
'message': {},
'dir': G.COLAB_DIR,
}
if G.AGENT:
data['owner'] = G.AGENT.owner
data['username'] = G.AGENT.username
data['workspace'] = G.AGENT.workspace
if exception:
data['message'] = {
'description': str(exception),
'stack': traceback.format_exc(exception)
}
msg.log('Floobits plugin error! Sending exception report: %s' % data['message'])
if description:
data['message']['description'] = description
try:
# TODO: use G.AGENT.proto.host?
api_url = 'https://%s/api/log' % (G.DEFAULT_HOST)
r = api_request(G.DEFAULT_HOST, api_url, data)
G.ERRORS_SENT += 1
return r
except Exception as e:
print(e)
开发者ID:blake-newman,项目名称:floobits-sublime,代码行数:32,代码来源:api.py
示例7: connect
def connect(self, cb=None):
self.stop(False)
self.empty_selects = 0
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.secure:
if ssl:
cert_path = os.path.join(G.COLAB_DIR, 'startssl-ca.pem')
with open(cert_path, 'wb') as cert_fd:
cert_fd.write(cert.CA_CERT.encode('utf-8'))
self.sock = ssl.wrap_socket(self.sock, ca_certs=cert_path, cert_reqs=ssl.CERT_REQUIRED)
else:
msg.log('No SSL module found. Connection will not be encrypted.')
if self.port == G.DEFAULT_PORT:
self.port = 3148 # plaintext port
msg.debug('Connecting to %s:%s' % (self.host, self.port))
try:
self.sock.connect((self.host, self.port))
if self.secure and ssl:
self.sock.do_handshake()
except socket.error as e:
msg.error('Error connecting:', e)
self.reconnect()
return
self.sock.setblocking(0)
msg.debug('Connected!')
self.reconnect_delay = G.INITIAL_RECONNECT_DELAY
self.send_auth()
if cb:
cb()
开发者ID:fgeller,项目名称:floobits-emacs,代码行数:29,代码来源:agent_connection.py
示例8: delete_buf
def delete_buf(path):
if not utils.is_shared(path):
msg.error('Skipping deleting %s because it is not in shared path %s.' % (path, G.PROJECT_PATH))
return
if os.path.isdir(path):
for dirpath, dirnames, filenames in os.walk(path):
# TODO: rexamine this assumption
# Don't care about hidden stuff
dirnames[:] = [d for d in dirnames if d[0] != '.']
for f in filenames:
f_path = os.path.join(dirpath, f)
if f[0] == '.':
msg.log('Not deleting buf for hidden file %s' % f_path)
else:
Listener.delete_buf(f_path)
return
buf_to_delete = None
rel_path = utils.to_rel_path(path)
for buf_id, buf in BUFS.items():
if rel_path == buf['path']:
buf_to_delete = buf
break
if buf_to_delete is None:
msg.error('%s is not in this room' % path)
return
msg.log('deleting buffer ', rel_path)
event = {
'name': 'delete_buf',
'id': buf_to_delete['id'],
}
Listener.agent.put(event)
开发者ID:rosshadden,项目名称:floobits-sublime,代码行数:31,代码来源:listener.py
示例9: on_auth
def on_auth(self):
self.authed = True
self.retries = G.MAX_RETRIES
msg.log("Successfully joined room %s/%s" % (self.owner, self.room))
if self._on_auth:
self._on_auth(self)
self._on_auth = None
开发者ID:nkabir,项目名称:floobits-vim,代码行数:7,代码来源:agent_connection.py
示例10: on_highlight
def on_highlight(self, data):
# floobits.highlight(data['id'], region_key, data['username'], data['ranges'], data.get('ping', False))
# buf_id, region_key, username, ranges, ping=False):
ping = data.get("ping", False)
if self.follow_mode:
ping = True
buf = self.FLOO_BUFS[data["id"]]
view = self.get_view(data["id"])
if not view:
if not ping:
return
view = self.create_view(buf)
if not view:
return
if ping:
try:
offset = data["ranges"][0][0]
except IndexError as e:
msg.debug("could not get offset from range %s" % e)
else:
msg.log("You have been summoned by %s" % (data.get("username", "an unknown user")))
view.focus()
view.set_cursor_position(offset)
if G.SHOW_HIGHLIGHTS:
view.highlight(data["ranges"], data["user_id"])
开发者ID:rdgmatos,项目名称:dot,代码行数:25,代码来源:protocol.py
示例11: create_buf
def create_buf(path):
# >>> (lambda x: lambda: x)(2)()
# TODO: check if functools can do this in st2
# really_create_buf = lambda x: (lambda: Listener.create_buf(x))
def really_create_buf(x):
return (lambda: Listener.create_buf(x))
if not utils.is_shared(path):
msg.error('Skipping adding %s because it is not in shared path %s.' % (path, G.PROJECT_PATH))
return
if os.path.isdir(path):
for dirpath, dirnames, filenames in os.walk(path):
# Don't care about hidden stuff
dirnames[:] = [d for d in dirnames if d[0] != '.']
for f in filenames:
f_path = os.path.join(dirpath, f)
if f[0] == '.':
msg.log('Not creating buf for hidden file %s' % f_path)
else:
sublime.set_timeout(really_create_buf(f_path), 0)
return
try:
buf_fd = open(path, 'rb')
buf = buf_fd.read().decode('utf-8')
rel_path = utils.to_rel_path(path)
msg.log('creating buffer ', rel_path)
event = {
'name': 'create_buf',
'buf': buf,
'path': rel_path,
}
Listener.agent.put(event)
except (IOError, OSError):
msg.error('Failed to open %s.' % path)
except Exception as e:
msg.error('Failed to create buffer %s: %s' % (path, str(e)))
开发者ID:nilbus,项目名称:sublime-text-2-plugin,代码行数:35,代码来源:listener.py
示例12: stop
def stop(self):
for _conn in self._protos:
_conn.stop()
self._protos = []
self._handlers = []
msg.log("Disconnected.")
editor.status_message("Disconnected.")
开发者ID:johnirvinestiamba,项目名称:floobits-sublime,代码行数:8,代码来源:reactor.py
示例13: update_view
def update_view(self, buf, view=None):
msg.debug('updating view for buf %s' % buf['id'])
view = view or self.get_view(buf['id'])
if not view:
msg.log('view for buf %s not found. not updating' % buf['id'])
return
self.MODIFIED_EVENTS.put(1)
view.set_text(buf['buf'])
开发者ID:nkabir,项目名称:floobits-vim,代码行数:8,代码来源:vim_protocol.py
示例14: on_delete_buf
def on_delete_buf(self, data):
# TODO: somehow tell the user about this. maybe delete on disk too?
del self.FLOO_BUFS[data['id']]
path = utils.get_full_path(data['path'])
if not G.DELETE_LOCAL_FILES:
msg.log('Not deleting %s because delete_local_files is disabled' % path)
return
utils.rm(path)
msg.warn('deleted %s because %s told me to.' % (path, data.get('username', 'the internet')))
开发者ID:nkabir,项目名称:floobits-vim,代码行数:9,代码来源:protocol.py
示例15: stop
def stop(self):
msg.log('Disconnecting from room %s/%s' % (self.owner, self.room))
try:
self.retries = -1
self.sock.shutdown(2)
self.sock.close()
except Exception:
pass
msg.log('Disconnected.')
开发者ID:nilbus,项目名称:sublime-text-2-plugin,代码行数:9,代码来源:agent_connection.py
示例16: stop
def stop(self):
msg.log("Disconnecting from room %s/%s" % (self.owner, self.room))
try:
self.retries = -1
self.sock.shutdown(2)
self.sock.close()
except Exception:
return False
msg.log("Disconnected.")
return True
开发者ID:nkabir,项目名称:floobits-vim,代码行数:10,代码来源:agent_connection.py
示例17: recurse
def recurse(self, root):
try:
paths = os.listdir(self.path)
except OSError as e:
if e.errno != errno.ENOTDIR:
msg.error('Error listing path ', self.path, ': ', str_e(e))
return
except Exception as e:
msg.error('Error listing path ', self.path, ': ', str_e(e))
return
msg.debug('Initializing ignores for ', self.path)
for ignore_file in IGNORE_FILES:
try:
self.load(ignore_file)
except Exception:
pass
for p in paths:
if p == '.' or p == '..':
continue
if p in BLACKLIST:
msg.log('Ignoring blacklisted file ', p)
continue
p_path = os.path.join(self.path, p)
try:
s = os.stat(p_path)
except Exception as e:
msg.error('Error stat()ing path ', p_path, ': ', str_e(e))
continue
if stat.S_ISREG(s.st_mode) and p in HIDDEN_WHITELIST:
# Don't count these whitelisted files in size
self.files.append(p_path)
continue
is_dir = stat.S_ISDIR(s.st_mode)
if root.is_ignored(p_path, is_dir, True):
continue
if is_dir:
ig = Ignore(p_path, self)
self.children[p] = ig
ig.recurse(root)
self.total_size += ig.total_size
continue
if stat.S_ISREG(s.st_mode):
if s.st_size > (MAX_FILE_SIZE):
self.ignores['/TOO_BIG/'].append(p)
msg.log(self.is_ignored_message(p_path, p, '/TOO_BIG/', False))
else:
self.size += s.st_size
self.total_size += s.st_size
self.files.append(p_path)
开发者ID:PengCoX,项目名称:Oh-My-Sublime,代码行数:55,代码来源:ignore.py
示例18: on_emacs_delete_buf
def on_emacs_delete_buf(self, req):
buf = self.get_buf_by_path(req['path'])
if not buf:
msg.debug('No buffer for path %s' % req['path'])
return
msg.log('deleting buffer ', buf['path'])
event = {
'name': 'delete_buf',
'id': buf['id'],
}
self.agent.put(event)
开发者ID:fgeller,项目名称:floobits-emacs,代码行数:11,代码来源:emacs_protocol.py
示例19: get_git_excludesfile
def get_git_excludesfile():
global_ignore = None
try:
p = subprocess.Popen(['git', 'config -z --get core.excludesfile'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = p.communicate()
global_ignore = result[0]
if not global_ignore:
return
global_ignore = os.path.realpath(os.path.expanduser(str(global_ignore)))
msg.log('git core.excludesfile is ', global_ignore)
except Exception as e:
msg.error('Error getting git core.excludesfile:', str_e(e))
return global_ignore
开发者ID:PengCoX,项目名称:Oh-My-Sublime,代码行数:13,代码来源:ignore.py
示例20: stop
def stop(self, log=True):
if log:
msg.log('Disconnecting from room %s/%s' % (self.owner, self.room))
sublime.cancel_timeout(self.reconnect_timeout)
self.reconnect_timeout = None
try:
self.retries = -1
self.sock.shutdown(2)
self.sock.close()
except Exception:
return False
if log:
msg.log('Disconnected.')
return True
开发者ID:fgeller,项目名称:floobits-emacs,代码行数:14,代码来源:agent_connection.py
注:本文中的msg.log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论