summaryrefslogtreecommitdiffstats
path: root/sdnvpn/lib/logutil.py
blob: 3710ca11a127924aab85c04a77fad3e1ead1e5b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
#
# Copyright (c) 2018 All rights reserved
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
import logging
import os.path

from xtesting.core import feature


def getLogger(module_name):
    logger = logging.getLogger(module_name)
    log_file = "{}/{}.log".format("/var/lib/xtesting/results", "bgpvpn")
    if os.path.exists(log_file):
        feature.Feature.configure_logger(logger, log_file)
    else:
        logger.setLevel(logging.DEBUG)
    return logger