Skip to content

Commit d447738

Browse files
committed
chore: replace use llama_stack logger
Signed-off-by: Mustafa Elbehery <[email protected]>
1 parent e3928e6 commit d447738

File tree

53 files changed

+117
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+117
-107
lines changed

llama_stack/core/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# the root directory of this source tree.
66

77
import importlib.resources
8-
import logging
98
import sys
109

1110
from pydantic import BaseModel
@@ -17,9 +16,10 @@
1716
from llama_stack.core.utils.exec import run_command
1817
from llama_stack.core.utils.image_types import LlamaStackImageType
1918
from llama_stack.distributions.template import DistributionTemplate
19+
from llama_stack.log import get_logger
2020
from llama_stack.providers.datatypes import Api
2121

22-
log = logging.getLogger(__name__)
22+
log = get_logger(name=__name__, category="core")
2323

2424
# These are the dependencies needed by the distribution server.
2525
# `llama-stack` is automatically installed by the installation script.

llama_stack/core/configure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
6-
import logging
76
import textwrap
87
from typing import Any
98

@@ -21,9 +20,10 @@
2120
from llama_stack.core.utils.config_dirs import EXTERNAL_PROVIDERS_DIR
2221
from llama_stack.core.utils.dynamic import instantiate_class_type
2322
from llama_stack.core.utils.prompt_for_config import prompt_for_config
23+
from llama_stack.log import get_logger
2424
from llama_stack.providers.datatypes import Api, ProviderSpec
2525

26-
logger = logging.getLogger(__name__)
26+
logger = get_logger(name=__name__, category="core")
2727

2828

2929
def configure_single_provider(registry: dict[str, ProviderSpec], provider: Provider) -> Provider:

llama_stack/core/library_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@
4848
from llama_stack.core.utils.config import redact_sensitive_fields
4949
from llama_stack.core.utils.context import preserve_contexts_async_generator
5050
from llama_stack.core.utils.exec import in_notebook
51+
from llama_stack.log import get_logger
5152
from llama_stack.providers.utils.telemetry.tracing import (
5253
CURRENT_TRACE_CONTEXT,
5354
end_trace,
5455
setup_logger,
5556
start_trace,
5657
)
5758

58-
logger = logging.getLogger(__name__)
59+
logger = get_logger(name=__name__, category="core")
5960

6061
T = TypeVar("T")
6162

llama_stack/core/request_headers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
import contextvars
88
import json
9-
import logging
109
from contextlib import AbstractContextManager
1110
from typing import Any
1211

1312
from llama_stack.core.datatypes import User
13+
from llama_stack.log import get_logger
1414

1515
from .utils.dynamic import instantiate_class_type
1616

17-
log = logging.getLogger(__name__)
17+
log = get_logger(name=__name__, category="core")
1818

1919
# Context variable for request provider data and auth attributes
2020
PROVIDER_DATA_VAR = contextvars.ContextVar("provider_data", default=None)

llama_stack/core/server/auth_providers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
)
2424
from llama_stack.log import get_logger
2525

26-
logger = get_logger(name=__name__, category="auth")
26+
logger = get_logger(name=__name__, category="core")
2727

2828

2929
class AuthResponse(BaseModel):

llama_stack/core/server/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def main(args: argparse.Namespace | None = None):
404404
config_contents = yaml.safe_load(fp)
405405
if isinstance(config_contents, dict) and (cfg := config_contents.get("logging_config")):
406406
logger_config = LoggingConfig(**cfg)
407-
logger = get_logger(name=__name__, category="server", config=logger_config)
407+
logger = get_logger(name=__name__, category="core", config=logger_config)
408408
if args.env:
409409
for env_pair in args.env:
410410
try:

llama_stack/core/utils/config_resolution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from llama_stack.core.utils.config_dirs import DISTRIBS_BASE_DIR
1111
from llama_stack.log import get_logger
1212

13-
logger = get_logger(name=__name__, category="config_resolution")
13+
logger = get_logger(name=__name__, category="core")
1414

1515

1616
DISTRO_DIR = Path(__file__).parent.parent.parent.parent / "llama_stack" / "distributions"

llama_stack/core/utils/exec.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
66

7-
import logging
87
import os
98
import signal
109
import subprocess
1110
import sys
1211

1312
from termcolor import cprint
1413

15-
log = logging.getLogger(__name__)
14+
from llama_stack.log import get_logger
15+
16+
log = get_logger(name=__name__, category="core")
1617

1718
import importlib
1819

llama_stack/core/utils/prompt_for_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
import inspect
88
import json
9-
import logging
109
from enum import Enum
1110
from typing import Annotated, Any, Literal, Union, get_args, get_origin
1211

1312
from pydantic import BaseModel
1413
from pydantic.fields import FieldInfo
1514
from pydantic_core import PydanticUndefinedType
1615

17-
log = logging.getLogger(__name__)
16+
from llama_stack.log import get_logger
17+
18+
log = get_logger(name=__name__, category="core")
1819

1920

2021
def is_list_of_primitives(field_type):

llama_stack/models/llama/llama3/multimodal/model.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
#
44
# This source code is licensed under the terms described in the LICENSE file in
55
# the root directory of this source tree.
6-
7-
import logging
86
import math
97
from collections.abc import Callable
108
from functools import partial
@@ -22,6 +20,8 @@
2220
from torch import Tensor, nn
2321
from torch.distributed import _functional_collectives as funcol
2422

23+
from llama_stack.log import get_logger
24+
2525
from ..model import ModelArgs, RMSNorm, apply_rotary_emb, precompute_freqs_cis
2626
from .encoder_utils import (
2727
build_encoder_attention_mask,
@@ -34,9 +34,10 @@
3434
from .image_transform import VariableSizeImageTransform
3535
from .utils import get_negative_inf_value, to_2tuple
3636

37-
logger = logging.getLogger(__name__)
3837
MP_SCALE = 8
3938

39+
logger = get_logger(name=__name__, category="models")
40+
4041

4142
def reduce_from_tensor_model_parallel_region(input_):
4243
"""All-reduce the input tensor across model parallel group."""
@@ -771,7 +772,7 @@ def load_hook(
771772
if embed is not None:
772773
# reshape the weights to the correct shape
773774
nt_old, nt_old, _, w = embed.shape
774-
logging.info(f"Resizing tile embedding from {nt_old}x{nt_old} to {self.num_tiles}x{self.num_tiles}")
775+
logger.info(f"Resizing tile embedding from {nt_old}x{nt_old} to {self.num_tiles}x{self.num_tiles}")
775776
embed_new = TilePositionEmbedding._dynamic_resize(embed, self.num_tiles)
776777
# assign the weights to the module
777778
state_dict[prefix + "embedding"] = embed_new

0 commit comments

Comments
 (0)