-# Copyright (C) 2009-2011 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2011-2012 W. Trevor King <wking@drexel.edu>
#
# This file is part of pypiezo.
#
-# pypiezo is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
+# pypiezo is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
#
-# pypiezo is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
+# pypiezo is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with pypiezo. If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU General Public License along with
+# pypiezo. If not, see <http://www.gnu.org/licenses/>.
-import logging as _logging
-import logging.handlers as _logging_handlers
+from .config import PackageConfig as _PackageConfig
-__version__ = '0.4'
+__version__ = '0.5'
-
-LOG = _logging.getLogger('pypiezo')
-"Pypiezo logger"
-
-LOG.setLevel(_logging.WARN)
-_formatter = _logging.Formatter(
- '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-
-_stream_handler = _logging.StreamHandler()
-_stream_handler.setLevel(_logging.DEBUG)
-_stream_handler.setFormatter(_formatter)
-LOG.addHandler(_stream_handler)
-
-_syslog_handler = None
-
-
-from .config import _BaseConfig
-from .config import find_base_config as _find_base_config
-
-
-def setup_base_config(config):
- global base_config, _syslog_handler
- base_config = config
-
- LOG.setLevel(base_config['log-level'])
-
- if base_config['syslog']:
- if not _syslog_handler:
- _syslog_handler = _logging_handlers.SysLogHandler()
- _syslog_handler.setLevel(_logging.DEBUG)
- LOG.handlers = [_syslog_handler]
- else:
- LOG.handlers = [_stream_handler]
-
- LOG.info('setup base_config:\n%s' % config.dump())
-
-def clear_base_config():
- setup_base_config(_BaseConfig())
-
-base_config = _find_base_config()
-setup_base_config(base_config)
+package_config = _PackageConfig(package_name=__name__)
+package_config.load_system()