Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
add raven install dependency - and update and freeze versions.
Browse files Browse the repository at this point in the history
add bauble.use_sentry_client preference key. (defaults to False.)
let Bauble set up the handler and only add it if user agrees.
related to #242.
  • Loading branch information
mfrasca committed Dec 29, 2015
1 parent 446f43a commit 27d662b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
12 changes: 7 additions & 5 deletions bauble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ def main(uri=None):
fileHandler.setLevel(logging.DEBUG)
consoleHandler.setLevel(consoleLevel)

# intialize the user preferences
from bauble.prefs import prefs
prefs.init()

try:
# no raven.conf.setup_logging: just standard Python logging
from raven import Client
Expand All @@ -320,7 +324,9 @@ def main(uri=None):
'00268114ed47460b94ce2b1b0b2a4a20@'
'app.getsentry.com/45704')
handler = SentryHandler(sentry_client)
logging.getLogger().addHandler(handler)
# only register the sentry client if the user agrees on it
if prefs[prefs.use_sentry_client_pref]:
logging.getLogger().addHandler(handler)
handler.setLevel(logging.WARNING)
except:
logger.warning("can't configure sentry client")
Expand All @@ -336,7 +342,6 @@ def main(uri=None):
sys.exit(1)

import bauble.pluginmgr as pluginmgr
from bauble.prefs import prefs
import bauble.utils as utils

# initialize threading
Expand All @@ -353,9 +358,6 @@ def main(uri=None):

default_icon = os.path.join(paths.lib_dir(), "images", "icon.svg")

# intialize the user preferences
prefs.init()

import threading
threading.Thread(target=check_and_notify_new_version).start()

Expand Down
21 changes: 21 additions & 0 deletions bauble/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@
Values: metric, imperial
"""

use_sentry_client_pref = 'bauble.use_sentry_client'
"""
During normal usage, Bauble produces a log file which contains
invaluable information for tracking down errors. This information is
normally saved in a file on the local workstation.
This preference key controls the option of sending exceptional
conditions (WARNING and ERROR, normally related to software problems)
to a central logging server, and developers will be notified by email
of the fact that you encountered a problem.
Logging messages at the levels Warning and Error do not contain personal
information. If you have completed the registration steps, a developer
might contact you to ask for further details, as it could be the
complete content of your log file.
Values: True, False (Default: False)
"""


from ConfigParser import RawConfigParser

Expand Down Expand Up @@ -133,6 +152,8 @@ def init(self):
self[config_version_pref] = config_version

# set some defaults if they don't exist
if use_sentry_client_pref not in self:
self[use_sentry_client_pref] = False
if picture_root_pref not in self:
self[picture_root_pref] = ''
if date_format_pref not in self:
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,14 @@ def run(self):
package_dir=all_package_dirs,
package_data=package_data,
data_files=data_files,
install_requires=["SQLAlchemy>=0.6",
install_requires=["SQLAlchemy==1.0.8",
"raven==5.9.2",
"Pillow==2.3.0",
"lxml",
"mako==0.9.1",
"gdata>=1.2.4",
"gdata==1.2.4",
"fibra==0.0.17",
"pyparsing>=1.5",
"pyparsing==2.0.1",
'python-dateutil<2.0'] + needs_sqlite,
test_suite="nose.collector",
author="Mario Frasca",
Expand Down

0 comments on commit 27d662b

Please sign in to comment.