Skip to content

Commit

Permalink
revert logging changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghaibao committed Sep 28, 2023
1 parent 4369147 commit 2b8711a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
17 changes: 16 additions & 1 deletion jcvi/apps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from typing import Any, Collection, List, Optional, Union

from natsort import natsorted
from rich.logging import RichHandler
from rich.logging import Console, RichHandler

from jcvi import __copyright__, __version__

Expand All @@ -38,6 +38,21 @@
JCVIHELP = "JCVI utility libraries {} [{}]\n".format(__version__, __copyright__)


def debug(level=logging.DEBUG):
"""
Turn on the debugging
"""
logging.basicConfig(
level=level,
format="%(message)s",
datefmt="[%X]",
handlers=[RichHandler(console=Console(stderr=True))],
)


debug()


def get_logger(name: str):
"""Return a logger with a default ColoredFormatter."""
logger = logging.getLogger(name)
Expand Down
10 changes: 6 additions & 4 deletions jcvi/graphics/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import sys
import logging

logging.getLogger("matplotlib").setLevel(logging.WARNING)
logging.getLogger("numexpr").setLevel(logging.WARNING)
logging.getLogger("PIL").setLevel(logging.INFO)


from functools import partial

import numpy as np
Expand All @@ -32,12 +37,9 @@
from matplotlib.path import Path
from typing import Optional

from ..apps.base import datadir, get_logger, glob, listify, logger, sample_N, which
from ..apps.base import datadir, glob, listify, logger, sample_N, which
from ..formats.base import LineFile

get_logger("matplotlib").setLevel(logging.WARNING)
get_logger("numexpr").setLevel(logging.WARNING)
logging.getLogger("PIL").setLevel(logging.INFO)

CHARS = {
"&": r"\&",
Expand Down

0 comments on commit 2b8711a

Please sign in to comment.