How to use the coloredlogs.install function in coloredlogs

To help you get started, weā€™ve selected a few coloredlogs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rhshah / iCallSV / iCallSV / sortbamByReadName.py View on Github external
:Description: This module will sort bam file by name
"""
'''
Created on Mar 18, 2015
Description: This module will sort bam file by name
@author: Ronak H Shah
'''

import os
import sys
import pysam
import logging
import coloredlogs

logger = logging.getLogger('iCallSV.sortbamByReadName')
coloredlogs.install(level='DEBUG')

def sortBam(inputBam, outputBamName, outputDir):
    logger.info("sortbamByReadName: Trying to sort BAM file by Read Name")
    if(os.path.isdir(outputDir)):
        logger.info("sortbamByReadName: The output directory %s exists", outputDir)
        outputFile = outputDir + "/" + outputBamName
    else:
        logger.info("sortbamByReadName: The output directory %s does not exists !!", outputDir)
        sys.exit()

    if(os.path.isfile(inputBam)):
        try:
            pysam.sort("-n", inputBam, outputFile)
        except IndexError as err:
            exception = "Index error({0}): {1}".format(err.errno, err.strerror)
            logger.info("%s", exception)
github rhshah / iCallSV / iCallSV / FilterDellyCalls.py View on Github external
::Output::
Filtered VCF files
'''
import os
import sys
import vcf
import re
import checkparameters as cp
import checkHotSpotList as chl
import checkBlackList as cbl
import logging
import coloredlogs

logger = logging.getLogger('iCallSV.FilterDellyCalls')
coloredlogs.install(level='DEBUG')

def run(
        inputVcf,
        outputDir,
        controlId,
        caseID,
        hotspotFile,
        blacklistFile,
        svlength,
        mapq,
        mapqHotspot,
        caseAltFreqHotspot,
        caseTotalCountHotspot,
        controlAltFreqHotspot,
        caseAltFreq,
        caseTotalCount,
github robotcaresystems / RoboticsLanguage / RoboticsLanguage / Base / Utilities.py View on Github external
global_function_cache[hash] = result
      # print 'cache: + ' + str(hash) + '>>>'
    else:
      result = global_function_cache[hash]
      # print 'use: - ' + str(hash) + '>>>'
    return result
  return wrapper


# -------------------------------------------------------------------------------------------------
#  logging utilities
# -------------------------------------------------------------------------------------------------


# install colours in the logger
coloredlogs.install(fmt='%(levelname)s: %(message)s', level='WARN')


# set the logger level
def setLoggerLevel(level):
  coloredlogs.install(fmt='%(levelname)s: %(message)s', level=level.upper())


# command line codes for colors
class color:
  PURPLE = '\033[95m'
  CYAN = '\033[96m'
  DARKCYAN = '\033[36m'
  BLUE = '\033[94m'
  GREEN = '\033[92m'
  YELLOW = '\033[93m'
  RED = '\033[91m'
github catalyst-cooperative / pudl / src / pudl / cli.py View on Github external
def main():
    """Parse command line and initialize PUDL DB."""
    # Display logged output from the PUDL package:
    logger = logging.getLogger(pudl.__name__)
    log_format = '%(asctime)s [%(levelname)8s] %(name)s:%(lineno)s %(message)s'
    coloredlogs.install(fmt=log_format, level='INFO', logger=logger)

    args = parse_command_line(sys.argv)
    with pathlib.Path(args.settings_file).open() as f:
        script_settings = yaml.safe_load(f)

    try:
        pudl_in = script_settings["pudl_in"]
    except KeyError:
        pudl_in = pudl.workspace.setup.get_defaults()["pudl_in"]
    try:
        pudl_out = script_settings["pudl_out"]
    except KeyError:
        pudl_out = pudl.workspace.setup.get_defaults()["pudl_out"]

    pudl_settings = pudl.workspace.setup.derive_paths(
        pudl_in=pudl_in, pudl_out=pudl_out)
github vpaliy / twitter-santa / tweebot / __init__.py View on Github external
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function

import logging
import coloredlogs

from tweebot.agents import UserAgentProvider

__author__ = "Vasyl Paliy"
__version__ = '2.3'
__license___ = "MIT"

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
coloredlogs.install(level='INFO', logger=logger)
coloredlogs.install(fmt='%(asctime)s | %(message)s')

ua_provider = UserAgentProvider()
github costastf / locationsharinglib / _CI / library / core_library.py View on Github external
def setup_logging(level):
    try:
        import coloredlogs
        coloredlogs.install(level=level.upper())
    except ImportError:
        LOGGER = logging.getLogger()
        handler = logging.StreamHandler()
        handler.setLevel(level.upper())
        formatter = logging.Formatter(('%(asctime)s - '
                                       '%(name)s - '
                                       '%(levelname)s - '
                                       '%(message)s'))
        handler.setFormatter(formatter)
        LOGGER.addHandler(handler)
        LOGGER.setLevel(level.upper())
    for logger in LOGGERS_TO_DISABLE:
        logging.getLogger(logger).disabled = True
github Clinical-Genomics / scout / scout / commands / base.py View on Github external
def loglevel(ctx):
    """Set app cli log level"""
    log_level = ctx.find_root().params["loglevel"]
    log_format = None
    coloredlogs.install(level=log_level, fmt=log_format)
    LOG.info("Running scout version %s", __version__)
    LOG.debug("Debug logging enabled.")
github gromgull / py-vox-io / examples / roundtrip.py View on Github external
import sys
import coloredlogs
from pyvox.parser import VoxParser
from pyvox.writer import VoxWriter

coloredlogs.install(level='DEBUG')

m1 = VoxParser(sys.argv[1]).parse()

print(m1)

VoxWriter('test.vox', m1).write()

m2 = VoxParser('test.vox').parse()

print(m2)

assert m1.models == m2.models
github raghur / easyblogger / blogger / main.py View on Github external
file_parser = subparsers.add_parser(
        "file",
        help="Figure out what to do from the input file")
    file_parser.add_argument(
        "file",
        nargs="+",
        help="Post content - input file")

    config = os.path.expanduser("~/.easyblogger")
    if (os.path.exists(config)):
        sysargv = ["@" + config] + sysargv
    args = parser.parse_args(sysargv)
    verbosity = logging.getLevelName(args.verbose)
    # print(verbosity, logging.getLevelName(verbosity))
    coloredlogs.install(verbosity)
    if args.verbose != "critical":
        logger.setLevel(logging.INFO)
        logger.info("setting log level to: %s ", args.verbose)
    logger.setLevel(verbosity)

    logger.debug("Final args:")
    logger.debug(sysargv)

    return args
github QKaiser / cottontail / main.py View on Github external
print(HEADER)
    parser = argparse.ArgumentParser(description=\
        "Capture all RabbitMQ messages being sent through a broker.")
    parser.add_argument('url', type=str, help="rabbitmq_management URL")
    parser.add_argument('--username', type=str, default="guest",\
        help="rabbitmq_management username")
    parser.add_argument('--password', type=str, default="guest",\
        help="rabbitmq_management password")
    parser.add_argument('-v', '--verbose', help="increase output verbosity",\
        action='store_true')
    args = parser.parse_args()

    logger = verboselogs.VerboseLogger('cottontail')
    logger.addHandler(logging.StreamHandler())
    logger.setLevel(logging.VERBOSE)
    coloredlogs.install(
        fmt='%(asctime)s %(levelname)s %(message)s',
        logger=logger,
        level='debug' if args.verbose else 'verbose'
    )

    o = urlparse(args.url)
    if o.port is None:
        raise Exception("Invalid URL provided.")

    rbmq = RabbitMQManagementClient(
        o.hostname,
        port=o.port,
        username=args.username,
        password=args.password,
        ssl=(o.scheme == "https")
    )