1
0
mirror of https://github.com/vmware/vsphere-automation-sdk-python.git synced 2024-11-27 03:30:00 -05:00
vsphere-automation-sdk-python/vsphere/samples/common/logging_context.py

38 lines
1.1 KiB
Python
Raw Normal View History

2016-10-26 19:08:23 -04:00
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2013. All Rights Reserved.
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER ORAL OR WRITTEN,
* EXPRESS OR IMPLIED. THE AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED
* WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY,
* NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
"""
__author__ = 'VMware'
__copyright__ = 'Copyright 2013 VMware, Inc. All rights reserved.'
from os import path
import logging.config
class LoggingContext(object):
logging.config.fileConfig(path.join(path.dirname(path.realpath(__file__)), '../../../logging.conf'), disable_existing_loggers=False)
@classmethod
def get_logger(cls, name):
return logging.getLogger(name)
def main():
logger = LoggingContext.get_logger(__name__)
logger.critical('critical')
logger.info('info')
logger.debug('debug')
# Start program
# just for testing
if __name__ == "__main__":
main()