Skip to content

Commit

Permalink
refactor(util): remove unused get_logger utility function (#8760)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Mar 25, 2024
1 parent 33c60b1 commit 0aceefc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 56 deletions.
3 changes: 0 additions & 3 deletions ibis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,5 @@ def connect(*args, **kwargs):
proxy.name = name
proxy._from_url = backend._from_url
proxy._to_sqlglot = backend._to_sqlglot
# Add any additional methods that should be exposed at the top level
for name in getattr(backend, "_top_level_methods", ()):
setattr(proxy, name, getattr(backend, name))

return proxy
54 changes: 1 addition & 53 deletions ibis/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import functools
import importlib.metadata
import itertools
import logging
import operator
import os
import sys
Expand All @@ -17,13 +16,7 @@
import uuid
import warnings
from types import ModuleType
from typing import (
TYPE_CHECKING,
Any,
Callable,
Generic,
TypeVar,
)
from typing import TYPE_CHECKING, Any, Callable, Generic, TypeVar
from uuid import uuid4

import toolz
Expand Down Expand Up @@ -321,51 +314,6 @@ def convert_unit(value, unit, to, floor: bool = True):
return op(value, factor)


def get_logger(
name: str,
level: str | None = None,
format: str | None = None,
propagate: bool = False,
) -> logging.Logger:
"""Get a logger.
Parameters
----------
name
Logger name
level
Logging level
format
Format string
propagate
Propagate the logger
Returns
-------
logging.Logger
"""
logging.basicConfig()
handler = logging.StreamHandler()

if format is None:
format = (
"%(relativeCreated)6d "
"%(name)-20s "
"%(levelname)-8s "
"%(threadName)-25s "
"%(message)s"
)
handler.setFormatter(logging.Formatter(fmt=format))
logger = logging.getLogger(name)
logger.propagate = propagate
logger.setLevel(
level or getattr(logging, os.environ.get("LOGLEVEL", "WARNING").upper())
)
logger.addHandler(handler)
return logger


# taken from the itertools documentation
def consume(iterator: Iterator[T], n: int | None = None) -> None:
"""Advance `iterator` n-steps ahead. If `n` is `None`, consume entirely."""
Expand Down

0 comments on commit 0aceefc

Please sign in to comment.