def init(): # root logger root_logger.propagate = False root_logger.setLevel(_DEBUG_LOG_LEVEL) root_handler.addFilter(MultiFilter(['ubuntuone.SyncDaemon', 'twisted', 'pyinotify'])) root_handler.setFormatter(basic_formatter) root_handler.setLevel(_DEBUG_LOG_LEVEL) root_logger.addHandler(root_handler) # exception logs exception_handler.setFormatter(basic_formatter) exception_handler.setLevel(logging.ERROR) # add the exception handler to the root logger logging.getLogger('').addHandler(exception_handler) root_logger.addHandler(exception_handler) # hook twisted.python.log with standard logging from twisted.python import log observer = log.PythonLoggingObserver('twisted') observer.start() # configure the logger to only show errors twisted_logger.propagate = False twisted_logger.setLevel(logging.ERROR) twisted_logger.addHandler(root_handler) twisted_logger.addHandler(exception_handler) # set the filesystem logging setup_filesystem_logging(filesystem_logger, root_handler) # invalid filenames log invnames_logger = logging.getLogger("ubuntuone.SyncDaemon.InvalidNames") invnames_logger.setLevel(_DEBUG_LOG_LEVEL) invnames_handler = CustomRotatingFileHandler(filename=INVALIDLOGFILENAME) invnames_handler.setFormatter(basic_formatter) invnames_handler.setLevel(logging.INFO) invnames_logger.addHandler(invnames_handler) # broken nodes log brokennodes_logger = logging.getLogger("ubuntuone.SyncDaemon.BrokenNodes") brokennodes_logger.setLevel(_DEBUG_LOG_LEVEL) brokennodes_handler = CustomRotatingFileHandler(filename=BROKENLOGFILENAME) brokennodes_handler.setFormatter(basic_formatter) brokennodes_handler.setLevel(logging.INFO) brokennodes_logger.addHandler(brokennodes_handler)
POLICY_URL_KEY, UI_EXECUTABLE_KEY, TC_URL_KEY, ) from ubuntuone import clientdefs from ubuntuone.logger import ( basic_formatter, CustomRotatingFileHandler, log_call, ) from ubuntuone.platform.logger import ubuntuone_log_dir LOG_LEVEL = logging.DEBUG path = os.path.join(ubuntuone_log_dir, 'credentials.log') MAIN_HANDLER = CustomRotatingFileHandler(path) MAIN_HANDLER.setFormatter(basic_formatter) MAIN_HANDLER.setLevel(LOG_LEVEL) logger = logging.getLogger("ubuntuone.credentials") logger.setLevel(LOG_LEVEL) logger.addHandler(MAIN_HANDLER) NO_OP = lambda *args, **kwargs: None Q_ = lambda string: gettext.dgettext(clientdefs.GETTEXT_PACKAGE, string) APP_NAME = u"Magicicada" TC_URL = u"https://one.ubuntu.com/terms/" POLICY_URL = u"https://one.ubuntu.com/privacy/" def platform_data():
# individual source file, and distribute linked combinations # including the two. # You must obey the GNU General Public License in all respects # for all of the code used other than OpenSSL. If you modify # file(s) with this exception, you may extend this exception to your # version of the file(s), but you are not obligated to do so. If you # do not wish to do so, delete this exception statement from your # version. If you delete this exception statement from all source # files in the program, then also delete it here. """SyncDaemon logging utilities and config.""" import logging import os from ubuntuone.logger import ( _DEBUG_LOG_LEVEL, basic_formatter, CustomRotatingFileHandler, ) from ubuntuone.platform.xdg_base_directory import ubuntuone_log_dir LOGFILENAME = os.path.join(ubuntuone_log_dir, 'status.log') logger = logging.getLogger("ubuntuone.status") logger.setLevel(_DEBUG_LOG_LEVEL) handler = CustomRotatingFileHandler(filename=LOGFILENAME) handler.setFormatter(basic_formatter) handler.setLevel(_DEBUG_LOG_LEVEL) logger.addHandler(handler)
# OpenSSL library under certain conditions as described in each # individual source file, and distribute linked combinations # including the two. # You must obey the GNU General Public License in all respects # for all of the code used other than OpenSSL. If you modify # file(s) with this exception, you may extend this exception to your # version of the file(s), but you are not obligated to do so. If you # do not wish to do so, delete this exception statement from your # version. If you delete this exception statement from all source # files in the program, then also delete it here. """SyncDaemon logging utilities and config.""" import logging import os from ubuntuone.logger import ( basic_formatter, CustomRotatingFileHandler, ) from ubuntuone.platform.logger import ubuntuone_log_dir LOGFILENAME = os.path.join(ubuntuone_log_dir, 'proxy.log') logger = logging.getLogger("ubuntuone.proxy") logger.setLevel(logging.DEBUG) handler = CustomRotatingFileHandler(filename=LOGFILENAME) handler.setFormatter(basic_formatter) handler.setLevel(logging.DEBUG) logger.addHandler(handler)