codekingpro/portable-devtools
114k
1# Copyright The OpenTelemetry Authors2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14"""15The OpenTelemetry logging API describes the classes used to generate logs and events.16 17The :class:`.LoggerProvider` provides users access to the :class:`.Logger`.18 19This module provides abstract (i.e. unimplemented) classes required for20logging, and a concrete no-op implementation :class:`.NoOpLogger` that allows applications21to use the API package alone without a supporting implementation.22 23To get a logger, you need to provide the package name from which you are24calling the logging APIs to OpenTelemetry by calling `LoggerProvider.get_logger`25with the calling module name and the version of your package.26 27The following code shows how to obtain a logger using the global :class:`.LoggerProvider`::28 29 from opentelemetry._logs import get_logger30 31 logger = get_logger("example-logger")32 33.. versionadded:: 1.15.034"""35 36from opentelemetry._logs._internal import (37 Logger,38 LoggerProvider,39 LogRecord,40 NoOpLogger,41 NoOpLoggerProvider,42 get_logger,43 get_logger_provider,44 set_logger_provider,45)46from opentelemetry._logs.severity import SeverityNumber47 48__all__ = [49 "Logger",50 "LoggerProvider",51 "LogRecord",52 "NoOpLogger",53 "NoOpLoggerProvider",54 "get_logger",55 "get_logger_provider",56 "set_logger_provider",57 "SeverityNumber",58]59 