LoginSignup
4
1

More than 3 years have passed since last update.

Python:ロギング設定ファイルに記載されている`ext://sys.stdout`の`ext`の意味

Last updated at Posted at 2019-04-28

環境

  • Python3.6.6
    • logging v0.5.1.2

背景

ロギング設定ファイルのサンプルコードにext://sys.stdoutという文字列がありました。
このextの意味をGoogleでけんさくが分からなかったので、調べてまとめました。

補足

"ext://sys.stdout"でGoogle検索しましたが見つからなかった(2019/04/28実施)ので、extの意味がすぐに分かりませんでした。
どのような検索方法にすればよかったのでしょうか。。。

image.png

version: 1
formatters:
  simple:
    format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
handlers:
  console:
    class: logging.StreamHandler
    level: DEBUG
    formatter: simple
    stream: ext://sys.stdout
loggers:
  simpleExample:
    level: DEBUG
    handlers: [console]
    propagate: no
root:
  level: DEBUG
  handlers: [console]

extスキーマは外部オブジェクトへのアクセスを意味します

テキストファイルでは、sys.stderr をリテラル文字列 'sys.stderr' と区別する標準の方法がありません。この区別を容易にするため、環境設定システムは、文字列中の特定の特殊接頭辞を見つけ、それらを特殊に扱います。例えば、リテラル文字列 'ext://sys.stderr' が設定中の値として与えられたら、この ext:// は剥ぎ取られ、この値の残りが普通のインポート機構で処理されます。

extはたぶんexternalの略ですね。

ちなみに内部オブジェクトにアクセスする場合は、cfgスキーマを使うとのことです。cfgはたぶんconfigurationの略ですね。
https://docs.python.org/ja/3.6/library/logging.config.html#access-to-internal-objects

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1