23 lines
536 B
Python
23 lines
536 B
Python
|
|
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||
|
|
# SPDX-License-Identifier: Apache-2.0
|
||
|
|
|
||
|
|
import logging
|
||
|
|
|
||
|
|
_LOGGER_CONFIGURED = False
|
||
|
|
|
||
|
|
|
||
|
|
# ref: SGLang
|
||
|
|
def configure_logger(prefix: str = ""):
|
||
|
|
global _LOGGER_CONFIGURED
|
||
|
|
if _LOGGER_CONFIGURED:
|
||
|
|
return
|
||
|
|
|
||
|
|
_LOGGER_CONFIGURED = True
|
||
|
|
|
||
|
|
logging.basicConfig(
|
||
|
|
level=logging.INFO,
|
||
|
|
format=f"[%(asctime)s{prefix}] %(filename)s:%(lineno)d - %(message)s",
|
||
|
|
datefmt="%Y-%m-%d %H:%M:%S",
|
||
|
|
force=True,
|
||
|
|
)
|