Here are the examples of the python api sys.version.splitlines taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
Project: intelmq Source File: bot.py
def __init__(self, bot_id):
self.__log_buffer = []
self.parameters = Parameters()
self.__error_retries_counter = 0
self.__source_pipeline = None
self.__destination_pipeline = None
self.logger = None
try:
version_info = sys.version.splitlines()[0].strip()
self.__log_buffer.append(('info',
'{} initialized with id {} and version '
'{} as process {}.'
''.format(self.__class__.__name__,
bot_id, version_info,
os.getpid())))
self.__log_buffer.append(('debug', 'Library path: %r.' % __file__))
self.__load_defaults_configuration()
self.__load_system_configuration()
self.__check_bot_id(bot_id)
self.__bot_id = bot_id
if self.parameters.logging_handler == 'syslog':
syslog = self.parameters.logging_syslog
else:
syslog = False
self.logger = utils.log(self.__bot_id, syslog=syslog,
log_path=self.parameters.logging_path,
log_level=self.parameters.logging_level)
except:
self.__log_buffer.append(('critical', traceback.format_exc()))
self.stop()
else:
for line in self.__log_buffer:
getattr(self.logger, line[0])(line[1])
try:
self.logger.info('Bot is starting.')
self.__load_runtime_configuration()
self.__load_pipeline_configuration()
self.__load_harmonization_configuration()
if not getattr(self.parameters, 'enabled', True):
self.logger.warn('The bot was disabled by configuration. '
'It will not be started as long as this '
'configuration is present.')
self.stop()
self.init()
self.__sighup = False
signal.signal(signal.SIGHUP, self.__handle_sighup_signal)
# system calls should not be interrupted, but restarted
signal.siginterrupt(signal.SIGHUP, False)
except Exception as exc:
if self.parameters.error_log_exception:
self.logger.exception('Bot initialization failed.')
else:
self.logger.error(utils.error_message_from_exc(exc))
self.logger.error('Bot initialization failed.')
self.stop()
raise