本文整理汇总了Python中stp_core.common.log.getlogger函数的典型用法代码示例。如果您正苦于以下问题:Python getlogger函数的具体用法?Python getlogger怎么用?Python getlogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getlogger函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,
name: str,
basedirpath: str,
client: Client = None,
wallet: Wallet = None,
port: int = None,
loop=None,
config=None,
endpointArgs=None):
config = config or getConfig()
basedirpath = basedirpath or os.path.expanduser(config.baseDir)
portParam, _ = self.getPassedArgs()
self.logger = getlogger()
super().__init__(name, basedirpath, client, wallet,
portParam or port, loop=loop, config=config,
endpointArgs=endpointArgs)
self.claimVersionNumber = 0.01
self._invites = {}
self.updateClaimVersionFile(self.getClaimVersionFileName())
signal.signal(signal.SIGTERM, self.exit_gracefully)
self.setupLogging(self.getLoggerFilePath())
示例2: run_node
def run_node(config, name, node_ip, node_port, client_ip, client_port):
node_ha = HA(node_ip, node_port)
client_ha = HA(client_ip, client_port)
node_config_helper = NodeConfigHelper(name, config)
logFileName = os.path.join(node_config_helper.log_dir, name + ".log")
logger = getlogger()
Logger().apply_config(config)
Logger().enableFileLogging(logFileName)
logger.setLevel(config.logLevel)
logger.debug("You can find logs in {}".format(logFileName))
vars = [var for var in os.environ.keys() if var.startswith("INDY")]
logger.debug("Indy related env vars: {}".format(vars))
with Looper(debug=config.LOOPER_DEBUG) as looper:
node = Node(name,
config_helper=node_config_helper,
ha=node_ha, cliha=client_ha)
node = integrate(node_config_helper, node, logger)
looper.add(node)
looper.run()
示例3: _dump
def _dump():
logger = getlogger()
cli = ctx['current_cli']
nocli = {"cli": False}
wrts = ''.join(cli.cli.output.writes)
logger.info('=========================================', extra=nocli)
logger.info('| OUTPUT DUMP |', extra=nocli)
logger.info('-----------------------------------------', extra=nocli)
for w in wrts.splitlines():
logger.info('> ' + w, extra=nocli)
logger.info('=========================================', extra=nocli)
示例4: decode_err_handler
from ledger.genesis_txn.genesis_txn_file_util import genesis_txn_path
from plenum.common.config_util import getConfig
from storage.kv_store_rocksdb_int_keys import KeyValueStorageRocksdbIntKeys
from stp_core.common.constants import ZMQ_NETWORK_PROTOCOL
from stp_core.common.log import getlogger
from pympler import muppy, summary, asizeof
def decode_err_handler(error):
length = error.end - error.start
return length * ' ', error.end
codecs.register_error('decode_errors', decode_err_handler)
logger = getlogger()
MBs = 1024 * 1024
INDY_ENV_FILE = "indy.env"
NODE_CONTROL_CONFIG_FILE = "node_control.conf"
INDY_NODE_SERVICE_FILE_PATH = "/etc/systemd/system/indy-node.service"
NODE_CONTROL_SERVICE_FILE_PATH = "/etc/systemd/system/indy-node-control.service"
NUMBER_TXNS_FOR_DISPLAY = 10
LIMIT_OBJECTS_FOR_PROFILER = 10
def none_on_fail(func):
def wrap(*args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as ex:
示例5: fault
def fault(ex: Exception, msg: str):
from stp_core.common.log import getlogger
getlogger().error(msg, exc_info=ex)
示例6: logger
def logger():
logger = getlogger()
old_value = logger.getEffectiveLevel()
logger.root.setLevel(logging.DEBUG)
yield logger
logger.root.setLevel(old_value)
示例7: Dict
from importlib.util import module_from_spec, spec_from_file_location
import os
from stp_core.common.log import getlogger
pluginsLoaded = {} # Dict(plugins_dir, List[plugin names])
pluginsNotFound = {} # Dict(plugins_dir, List[plugin names])
logger = getlogger("plugin-loader")
def loadPlugins(plugins_dir, plugins_to_load=None):
global pluginsLoaded
alreadyLoadedPlugins = pluginsLoaded.get(plugins_dir)
i = 0
if alreadyLoadedPlugins:
logger.debug("Plugins {} are already loaded from plugins_dir: {}".format(
alreadyLoadedPlugins, plugins_dir))
else:
logger.debug(
"Plugin loading started to load plugins from plugins_dir: {}".format(
plugins_dir))
if not os.path.exists(plugins_dir):
os.makedirs(plugins_dir)
logger.debug("Plugin directory created at: {}".format(
plugins_dir))
if plugins_to_load is not None:
for pluginName in plugins_to_load:
示例8: set_info_log_level
def set_info_log_level():
logger = getlogger()
lvl = logger.level
logger.setLevel(logging.INFO)
yield
logger.setLevel(lvl)
示例9: setTestLogLevel
def setTestLogLevel():
logger = getlogger()
logger.level = logging.NOTSET