How to use the colorlog.getLogger function in colorlog

To help you get started, we’ve selected a few colorlog 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 tijme / angularjs-csti-scanner / acstis / Driver.py View on Github external
def __set_angular_version(self, startpoint):
        """Find and set the AngularJS version as class attribute

        Args:
            startpoint (:class:`nyawc.http.Request`): The startpoint request.

        Returns:
            str: True if found and set, False otherwise.

        """

        if self.__args.angular_version:
            self.__angular_version = self.__args.angular_version
            colorlog.getLogger().info("Found AngularJS version " + self.__angular_version + " in the arguments.")
            return True

        colorlog.getLogger().info("Looking for AngularJS version using a headless browser.")
        colorlog.getLogger().info("Waiting until DOM is completely loaded.")

        self.__angular_version = BrowserHelper.javascript(
            QueueItem(startpoint, Response(self.__args.domain)),
            "return angular.version.full"
        )

        if self.__angular_version:
            colorlog.getLogger().info("Found AngularJS version " + self.__angular_version + ".")
            return True

        colorlog.getLogger().error("Couldn't determine the AngularJS version (`angular.version.full` threw an exception).")
        colorlog.getLogger().error("If you are certain this URL uses AngularJS, specify the version via the `--angular-version` argument.")
github bioconvert / bioconvert / bioconvert / phyloxml2nexus.py View on Github external
#                                                                         #
# You should have received a copy of the GNU General Public License       #
# along with this program (COPYING file).                                 #
# If not, see .                             #
###########################################################################

"""PHYLOXML2NEXUS converter"""
import os

import colorlog
from Bio import SeqIO

from bioconvert import ConvBase
from bioconvert.core.decorators import requires

_log = colorlog.getLogger(__name__)


__all__ = ['PHYLOXML2NEXUS']


class PHYLOXML2NEXUS(ConvBase):
    """
    Converts a tree file from :term:`PHYLOXML` format to :term:`NEXUS` format. ::
    """
    _default_method = 'gotree'


    def __init__(self, infile, outfile=None, alphabet=None, *args, **kwargs):
        """.. rubric:: constructor

        :param str infile: input :term:`PHYLOXML` file.
github bioconvert / bioconvert / bioconvert / ods2csv.py View on Github external
#                                                                         #
# You should have received a copy of the GNU General Public License       #
# along with this program (COPYING file).                                 #
# If not, see .                             #
###########################################################################
"""Convert :term:`XLS` format to :term:`CSV` format"""
import csv

import colorlog

from bioconvert.core.base import ConvArg
from bioconvert.core.decorators import requires, requires_nothing

from bioconvert import ConvBase

logger = colorlog.getLogger(__name__)


class ODS2CSV(ConvBase):
    """Convert :term:`XLS` file into :term:`CSV` file

    Method based on pyexcel [PYEXCEL].

    """
    _default_method = "pyexcel"
    DEFAULT_OUT_SEP = ','
    DEFAULT_LINE_TERMINATOR = '\n'

    def __init__(self, infile, outfile):
        """.. rubric:: constructor

        :param str infile:
github bioconvert / bioconvert / bioconvert / sam2bam.py View on Github external
# but WITHOUT ANY WARRANTY; without even the implied warranty of          #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           #
# GNU General Public License for more details.                            #
#                                                                         #
# You should have received a copy of the GNU General Public License       #
# along with this program (COPYING file).                                 #
# If not, see .                             #
###########################################################################

"""Convert :term:`SAM` file to :term:`BAM` file"""
from bioconvert import ConvBase
from bioconvert.core.decorators import requires

import colorlog

logger = colorlog.getLogger(__name__)

__all__ = ["SAM2BAM"]


class SAM2BAM(ConvBase):
    """Convert :term:`SAM` file to :term:`BAM` file"""

    _threading = True

    def __init__(self, infile, outfile, *args, **kargs):
        """.. rubric:: constructor

        :param str infile:
        :param str outfile:

        """
github bioconvert / bioconvert / bioconvert / bplink2plink.py View on Github external
# but WITHOUT ANY WARRANTY; without even the implied warranty of          #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           #
# GNU General Public License for more details.                            #
#                                                                         #
# You should have received a copy of the GNU General Public License       #
# along with this program (COPYING file).                                 #
# If not, see .                             #
###########################################################################
"""Convert :term:`BPLINK` to :term:`PLINK`"""
import colorlog

from bioconvert import ConvBase
from bioconvert.core.decorators import requires
from bioconvert.core.utils import generate_outfile_name

_log = colorlog.getLogger(__name__)


class BPLINK2PLINK(ConvBase):
    """Converts a genotype dataset bed+bim+fam in :term:`BPLINK` format to
    ped+map :term:`PLINK` format.

    Conversion is based on plink [PLINK]_ executable.

    .. warning:: **plink** takes several inputs and outputs and does not need
        extensions. What is required is a prefix. Bioconvert usage is therefore::

            bioconvert bplink2plink plink_toy

        Since there is no extension, you must be explicit by providing the
        conversion name (bplink2plink). This command will search for 3 input 
        files plink_toy.bed, plink_toy.bim and plink_toy.fam. It will then 
github bioconvert / bioconvert / bioconvert / clustal2phylip.py View on Github external
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           #
# GNU General Public License for more details.                            #
#                                                                         #
# You should have received a copy of the GNU General Public License       #
# along with this program (COPYING file).                                 #
# If not, see .                             #
###########################################################################
"""Convert :term:`CLUSTAL` to :term:`PHYLIP` format"""
import colorlog
from Bio import SeqIO

from bioconvert import ConvBase
from bioconvert.core.decorators import requires
from bioconvert.core.decorators import compressor

_log = colorlog.getLogger(__name__)

__all__ = ["CLUSTAL2PHYLIP"]


class CLUSTAL2PHYLIP(ConvBase):
    """
    Converts a sequence alignment from :term:`CLUSTAL` format to :term:`PHYLIP` format.

    Methods available are based on squizz [SQUIZZ]_ or biopython [BIOPYTHON]_, and
    goalign [GOALIGN]_.

    """
    _default_method = 'biopython'

    def __init__(self, infile, outfile=None, alphabet=None, *args, **kwargs):
        """.. rubric:: constructor
github bioconvert / bioconvert / bioconvert / bplink2vcf.py View on Github external
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           #
# GNU General Public License for more details.                            #
#                                                                         #
# You should have received a copy of the GNU General Public License       #
# along with this program (COPYING file).                                 #
# If not, see .                             #
###########################################################################
"""Convert :term:`BPLINK` to :term:`VCF`"""
import colorlog
import os

from bioconvert import ConvBase
from bioconvert.core.decorators import requires
from bioconvert.core.utils import generate_outfile_name

_log = colorlog.getLogger(__name__)


class BPLINK2VCF(ConvBase):
    """Converts a genotype dataset bed+bim+fam in :term:`BPLINK` format to
    vcf :term:`VCF` format

    Conversion is based on plink [PLINK]_ executable.

    .. warning:: **plink** takes several inputs and outputs and does not need
        extensions. What is required is a prefix. Bioconvert usage is therefore::

            bioconvert bplink2vcf plink_toy plink_toy.vcf

        Since there is no extension, you must be explicit by providing the
        conversion name (bplink2plink). This command will search for 3 input 
        files plink_toy.bed, plink_toy.bim and plink_toy.fam. It will then 
github tijme / angularjs-csti-scanner / acstis / helpers / FileLoggingHelper.py View on Github external
filename_error = False

        while os.path.isfile(filename) and not filename_error:
            filename_changed = True
            filename_append += 1
            filename = filename_backup + "." + str(filename_append)

            if filename_append == sys.maxsize:
                filename_error = True

        if filename_error:
            colorlog.getLogger().error("The output log file already exists and therefore no logs will be written.")
            return

        if filename_changed:
            colorlog.getLogger().warning("The output log filename was changed to `" + filename + "` since `" + filename_backup + "` already exists.")

        FileLoggingHelper.__filename = filename
github bioconvert / bioconvert / bioconvert / newick2phyloxml.py View on Github external
# but WITHOUT ANY WARRANTY; without even the implied warranty of          #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           #
# GNU General Public License for more details.                            #
#                                                                         #
# You should have received a copy of the GNU General Public License       #
# along with this program (COPYING file).                                 #
# If not, see .                             #
###########################################################################
"""Converts :term:`NEWICK` file to :term:`PHYLOXML` file."""
import colorlog

from bioconvert import ConvBase
from bioconvert.core.decorators import requires
from bioconvert.core.decorators import compressor

_log = colorlog.getLogger(__name__)


__all__ = ['NEWICK2PHYLOXML']


class NEWICK2PHYLOXML(ConvBase):
    """
    Converts a tree file from :term:`NEWICK` format to :term:`PHYLOXML` format.

    Methods available are based on gotree [GOTREE]_.

    """
    _default_method = 'gotree'

    def __init__(self, infile, outfile=None, alphabet=None, *args, **kwargs):
        """.. rubric:: constructor
github sequana / sequana / sequana / gui / tools.py View on Github external
def init_logger(self):
        self._mylogger = colorlog.getLogger("sequanix")
        """self._fh = open(self._logger_output, "w")
        self._handler = colorlog.StreamHandler(self._fh)