本文整理汇总了Python中goodcrypto.utils.log_file.LogFile类的典型用法代码示例。如果您正苦于以下问题:Python LogFile类的具体用法?Python LogFile怎么用?Python LogFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: log_message
def log_message(message):
''' Log a message to the local log. '''
global log
if log is None:
log = LogFile()
log.write_and_flush(message)
示例2: log_message
def log_message(message):
'''
Log a message.
>>> from syr.log import BASE_LOG_DIR
>>> from syr.user import whoami
>>> log_message('test')
>>> os.path.exists(os.path.join(BASE_LOG_DIR, whoami(), 'goodcrypto.mail.message.utils.log'))
True
'''
global _log
if _log is None:
_log = LogFile()
_log.write_and_flush(message)
示例3: log_message
def log_message(self, message):
''' Log a message. '''
if self.log is None:
self.log = LogFile()
self.log.write_and_flush(message)
示例4: __init__
def __init__(self, email, encryption_name, keyserver, user_initiated_search):
'''
>>> # In honor of Werner Koch, developer of gpg.
>>> email = '[email protected]'
>>> crypto_name = 'GPG'
>>> srk_class = SearchKeyserver(email, crypto_name, 'pgp.mit.edu', '[email protected]')
>>> srk_class != None
True
>>> srk_class = SearchKeyserver(None, crypto_name, 'pgp.mit.edu', '[email protected]')
>>> srk_class != None
True
>>> srk_class = SearchKeyserver(email, None, 'pgp.mit.edu', '[email protected]')
>>> srk_class != None
True
>>> srk_class = SearchKeyserver(email, crypto_name, None, '[email protected]')
>>> srk_class != None
True
>>> srk_class = SearchKeyserver(None, None, None, None)
>>> srk_class != None
True
'''
self.log = LogFile()
self.email = email
self.encryption_name = encryption_name
self.keyserver = keyserver
self.user_initiated_search = user_initiated_search
self.key_plugin = None
示例5: log_message
def log_message(message):
'''
Log a message to the local log.
>>> import os.path
>>> from syr.log import BASE_LOG_DIR
>>> from syr.user import whoami
>>> log_message('test')
>>> os.path.exists(os.path.join(BASE_LOG_DIR, whoami(), 'goodcrypto.mail.user_keys.log'))
True
'''
global log
if log is None:
log = LogFile()
log.write_and_flush(message)
示例6: log_message
def log_message(self, message):
'''
Record debugging messages.
'''
if self.log is None:
self.log = LogFile('goodcrypto.mail.log')
self.log.write(message)
示例7: log_message
def log_message(self, message):
'''
Log the message to the local log.
'''
if self.log is None:
self.log = LogFile()
self.log.write_and_flush(message)
示例8: __init__
def __init__(self, crypto_message):
'''
>>> decrypt = Debundle(None)
>>> decrypt != None
True
'''
self.log = LogFile()
self.crypto_message = crypto_message
self.messages_sent = 0
示例9: __init__
def __init__(self):
'''
>>> header_keys = HeaderKeys()
>>> header_keys != None
True
'''
self.log = LogFile()
self.recipient_to_notify = None
self.new_key_imported = False
示例10: __init__
def __init__(self, crypto_message):
'''
>>> encrypt = Encrypt(None)
>>> encrypt != None
True
'''
self._log = LogFile()
self.crypto_message = crypto_message
self.verification_code = None
self.ready_to_protect_metadata = False
示例11: __init__
def __init__(self, crypto_message):
'''
>>> decrypt = Decrypt(None)
>>> decrypt != None
True
'''
self.log = LogFile()
self.crypto_message = crypto_message
self.need_to_send_metadata_key = False
示例12: __init__
def __init__(self, home_dir, auto_check_trustdb=False):
'''
Create a new GPGExec object.
>>> gpg_exec = GPGExec('/var/local/projects/goodcrypto/server/data/oce/.gnupg')
>>> gpg_exec != None
True
'''
self.log = LogFile()
self.gpg_home = home_dir
self.result_code = gpg_constants.ERROR_RESULT
self.gpg_output = None
self.gpg_error = None
self.set_up_conf()
# --no-tty: Do not write anything to TTY
# --homedir: home directory for gpg's keyring files
# --verbose: give details if error
# --ignore-time-conflict: Since different machines have different ideas of what time it is, we want to ignore time conflicts.
# --ignore-valid-from: "valid-from" is just a different kind of time conflict.
# --batch: We're always in batch mode.
# --lock-once: Lock the databases the first time a lock is requested and do not release the lock until the process terminates.
# --no-auto-key-locate: Don't look for keys outside our system
# --no-auto-check-trustdb: Do not always update the trust db because it goes online
# --always-trust: We don't have any trust infrastructure yet.
# --utf8-strings: Assume all arguments are in UTF-8 format.
# redirect stdout and stderr so we can exam the results as needed
kwargs = dict(no_tty=True, verbose=True, homedir=self.gpg_home,
ignore_time_conflict=True, ignore_valid_from=True, batch=True,
no_auto_key_locate=True, lock_once=True, utf8_strings=True, _env=minimal_env())
# gpg tries to go online when it updates the trustdb
# so we don't want to check on every command
if auto_check_trustdb:
kwargs['auto_check_trustdb'] = True
self.log_message('auto_check_trustdb')
else:
kwargs['no_auto_check_trustdb'] = True
self.log_message('no_auto_check_trustdb')
if (self.gpg_home is not None and
os.path.exists(os.path.join(self.gpg_home, gpg_constants.TRUST_DB_FILENAME))):
kwargs['always_trust'] = True
self.gpg = sh.gpg.bake(**kwargs)
# make sure no old job has left locked files
self.clear_gpg_lock_files()
self.clear_gpg_tmp_files()
示例13: __init__
def __init__(self, email_message):
'''
Unparsable messages are wrapped in a valid message.
>>> from goodcrypto_tests.mail.message_utils import get_basic_email_message
>>> good_message = get_basic_email_message()
>>> validator = Validator(good_message)
>>> validator != None
True
'''
self.log = LogFile()
self.email_message = email_message
self.why = None
示例14: log_message
def log_message(self, message):
'''
Log the message to the local log.
>>> import os.path
>>> from syr.log import BASE_LOG_DIR
>>> from syr.user import whoami
>>> CryptoMessage().log_message('test')
>>> os.path.exists(os.path.join(BASE_LOG_DIR, whoami(), 'goodcrypto.mail.message.crypto_message.log'))
True
'''
if self.log is None:
self.log = LogFile()
self.log.write_and_flush(message)
示例15: log_message
def log_message(self, message):
'''
Record debugging messages.
>>> import os.path
>>> from syr.log import BASE_LOG_DIR
>>> from syr.user import whoami
>>> filter = Filter('[email protected]', ['[email protected]'], 'message')
>>> filter.log_message('test')
>>> os.path.exists(os.path.join(BASE_LOG_DIR, whoami(), 'goodcrypto.mail.message.filter.log'))
True
'''
if self.log is None:
self.log = LogFile()
self.log.write_and_flush(message)