mirror of
https://github.com/openkmip/pykmip
synced 2025-12-17 16:53:48 +00:00
Removing default log configuration and usage
This change removes the use of default logging settings in kmip.__init__.py as well as the bundled logconfig.ini file. Logging settings should be set by applications, not by underlying software libraries. All demos have been updated to set their own logging settings and to log at appropriate levels.
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from kmip.core import enums
|
||||
@@ -24,6 +23,8 @@ from kmip.pie import client
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logger = utils.build_console_logger(logging.INFO)
|
||||
|
||||
# Build and parse arguments
|
||||
parser = utils.build_cli_parser(enums.Operation.CREATE)
|
||||
opts, args = parser.parse_args(sys.argv[1:])
|
||||
@@ -34,18 +35,12 @@ if __name__ == '__main__':
|
||||
|
||||
# Exit early if the arguments are not specified
|
||||
if algorithm is None:
|
||||
logging.debug('No algorithm provided, exiting early from demo')
|
||||
logger.error('No algorithm provided, exiting early from demo')
|
||||
sys.exit()
|
||||
if length is None:
|
||||
logging.debug("No key length provided, exiting early from demo")
|
||||
logger.error("No key length provided, exiting early from demo")
|
||||
sys.exit()
|
||||
|
||||
# Build and setup logging and needed factories
|
||||
f_log = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
|
||||
'logconfig.ini')
|
||||
logging.config.fileConfig(f_log)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
algorithm = getattr(enums.CryptographicAlgorithm, algorithm, None)
|
||||
|
||||
# Build the client and connect to the server
|
||||
|
||||
Reference in New Issue
Block a user