Skip to content

Commit

Permalink
Merge pull request caikit#696 from mynhardtburger/alog-protocol-support
Browse files Browse the repository at this point in the history
Add alog protocol support
  • Loading branch information
gabe-l-hart authored Apr 16, 2024
2 parents 00ea569 + 4143965 commit 27aaa33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions caikit/core/exceptions/error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
# Standard
from collections.abc import Iterable
from types import GeneratorType
from typing import TYPE_CHECKING, Dict, NoReturn, Optional, Type
from typing import TYPE_CHECKING, Dict, NoReturn, Optional, Type, Union
import os
import typing

# First Party
from alog.protocols import LoggerProtocol

# Local
from caikit.config import get_config

Expand All @@ -38,7 +41,7 @@
_error_handlers: Dict[str, "ErrorHandler"] = {}


def get(log_chan: "Logger"):
def get(log_chan: Union["Logger", LoggerProtocol]):
"""Get an error handler associated with a given alog log channel. The same error handler will
be returned if this function is called repeatedly with the same log channel.
Expand All @@ -61,7 +64,7 @@ class ErrorHandler:
the `.log_raise` method.
"""

def __init__(self, log_chan: "Logger"):
def __init__(self, log_chan: Union["Logger", LoggerProtocol]):
"""Create a new error handler that provides reusable error checking and automatic logging.
Args:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ classifiers=[
]
dependencies = [
"alchemy-config>=1.1.1,<2.0.0",
"alchemy-logging>=1.0.4,<2.0.0",
"alchemy-logging>=1.3.2,<2.0.0",
"anytree>=2.7.0,<3.0",
"docstring-parser>=0.14.1,<0.17.0",
"grpcio>=1.35.0,<2.0,!=1.55.0",
Expand Down

0 comments on commit 27aaa33

Please sign in to comment.