mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
082db7a996
Co-authored-by: Suhas Deshpande <suhasdeshpande@users.noreply.github.com> Co-authored-by: Ariel Weinberger <Weinberger.Ariel@gmail.com> Co-authored-by: Suhas Deshpande <suhas2u@gmail.com>
26 lines
499 B
Python
26 lines
499 B
Python
"""
|
|
Logging setup for CopilotKit.
|
|
"""
|
|
|
|
import logging
|
|
import os
|
|
import sys
|
|
|
|
def get_logger(name: str):
|
|
"""
|
|
Get a logger with the given name.
|
|
"""
|
|
logger = logging.getLogger(name)
|
|
log_level = os.getenv('LOG_LEVEL')
|
|
if log_level:
|
|
logger.setLevel(log_level.upper())
|
|
return logger
|
|
|
|
def bold(text: str) -> str:
|
|
"""
|
|
Bold the given text.
|
|
"""
|
|
if hasattr(sys.stdout, 'isatty') and sys.stdout.isatty():
|
|
return f"\033[1m{text}\033[0m"
|
|
return text
|