Package: python-outfit
Info:utilities for distributed environmentRepository:https://github.com/situkangsayur/python-outfitAuthor:Hendri Karisma (http://github.com/situkangsayur)Maintainer:Hendri Karisma (http://github.com/situkangsayur)Python Outfit is set of dependencies across a range of python standard package for software development.Features for 0.0.6 version:Load config using yaml.Integrated to Consul.Load config file from a path in KV Consul.Integrated to Vault.Load Secret KV from Vault.add some db status to py-healtchecker.simple Logger.Load Logger configurations from consul, yaml, json, and dictionary logging var in python file.How to installOutfitYou can use pip for installing python-outfit.pip install python-outfitpypi link :link to outfitQuick StartJust add outfit packe then import the Class that you need. First to load configuration import Outfit class. Then callOufit.setup(‘config_path’)call setup static method and pass the path of the configuration file toOufit.setup()fromoutfitimportOutfitif__name__=='__main__':Outfit.setup('conf/configuration.yaml')Then you can importConsulConfor Consul Connection orVaulConfor Vault Connection, or you can useLoggerto do some logging text for debug, info, error, or critical mode.fromoutfitimportOutfitfromoutfitimportConsulCon,VaultConfromoutfitimportLoggerif__name__=='__main__':Outfit.setup('conf/configuration.yaml')con_consul=ConsulCon()Logger.debug('get the information such as config file from consul kv then will be returned as python dictionary')config_dict=con_consul.get_kv()con_vault=VaultCon()Logger.info('get the secret information in vault secret kv then will be returned as python dictionary')secret_dict=con_vault.get_secret_kv()The consul and vault connection will get the configs information from yaml file, including the Logger config source.This is the example of the .yaml file foroutfitconfigurations:vault:host:localhostport:9500scheme:httptoken:token123jhk123path:sample/appconsul:host:localhostport:9500scheme:httptoken:token123jhk123path:sample/applogconfig:mode:developmentsource_type:yaml_filesource_location:./tests/assets/logging.yamlWe can see that the logconfig will provide the log configuration information, it contains mode, source_type, and source_location:modeof log it depends on the logger profile that you write in log config.source_type, it can beyaml_file,json_file,consul_kv, anddictionarytype from python file.source_location, it will provide the location of the files or consul kv directory.Sample for log config usingsource_typeconsul kv:vault:host:localhostport:9500scheme:httptoken:token123jhk123path:sample/appconsul:host:localhostport:9500scheme:httptoken:token123jhk123path:sample/applogconfig:mode:developmentsource_type:consulkvsource_location:assets/logging.yamlAnd for logging yaml file or the structures :---version:1disable_existing_loggers:Falseformatters:simple:format:"%(asctime)s,%(levelname)s:%(filename)s(%(lineno)d)>%(message)s"handlers:debug_console:class:logging.StreamHandlerlevel:DEBUGformatter:simplestream:ext://sys.stdoutproduction_console:class:logging.StreamHandlerlevel:INFOformatter:simplestream:ext://sys.stdoutdebug_file_handler:class:logging.handlers.RotatingFileHandlerlevel:DEBUGformatter:simplefilename:tests/logs/debug.logmaxBytes:10485760# 10MBbackupCount:20encoding:utf8info_file_handler:class:logging.handlers.RotatingFileHandlerlevel:INFOformatter:simplefilename:tests/logs/info.logmaxBytes:10485760# 10MBbackupCount:20encoding:utf8error_file_handler:class:logging.handlers.RotatingFileHandlerlevel:ERRORformatter:simplefilename:tests/logs/errors.logmaxBytes:10485760# 10MBbackupCount:20encoding:utf8critical_file_handler:class:logging.handlers.RotatingFileHandlerlevel:CRITICALformatter:simplefilename:tests/logs/critical.logmaxBytes:10485760# 10MBbackupCount:20encoding:utf8loggers:development:level:DEBUGhandlers:[debug_console,debug_file_handler,info_file_handler,error_file_handler,critical_file_handler]propagate:Trueproduction:level:INFOhandlers:[production_console,info_file_handler,error_file_handler,critical_file_handler]propagate:True...you can get more detail about log config in yaml fromthis link