This repository has been archived by the owner on Jul 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
/
config.py
51 lines (43 loc) · 1.58 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
import sublime
import logging
from logging.handlers import RotatingFileHandler
import tempfile
mm_dir = os.path.dirname(__file__)
sublime_version = int(float(sublime.version()))
settings = None
merge_settings = None
logger = None
def setup_logging():
try:
settings = sublime.load_settings('mavensmate.sublime-settings')
logging.raiseExceptions = False
logging.basicConfig(level=logging.DEBUG)
log_location = settings.get('mm_plugin_logs_location', tempfile.gettempdir())
logging_handler = RotatingFileHandler(os.path.join(log_location, "mmst.log"), maxBytes=1*1024*1024, backupCount=5)
#mm log setup
global logger
logger = logging.getLogger('mmst')
logger.setLevel(logging.DEBUG)
logger.propagate = False
logger.addHandler(logging_handler)
except:
pass #TODO: need to handle this permission denied error (https://github.com/joeferraro/MavensMate-SublimeText/issues/293)
def debug(msg, obj=None):
try:
if obj != None and type(msg) is str:
logger.debug(msg + ' ', obj)
print('[MAVENSMATE]: ' + msg + ' ', obj)
elif obj == None and type(msg) is str:
logger.debug(msg)
print('[MAVENSMATE]:',msg)
else:
logger.debug(msg)
print('[MAVENSMATE]:',msg)
except:
if obj != None and type(msg) is str:
print('[MAVENSMATE]: ' + msg + ' ', obj)
elif obj == None and type(msg) is str:
print('[MAVENSMATE]:',msg)
else:
print('[MAVENSMATE]:',msg)