@@ -744,10 +744,13 @@ msgid ""
744744" manner and the result of the processing replaces the string value. If the "
745745"prefix is not recognised, then the string value will be left as-is."
746746msgstr ""
747+ "此类前缀的处理方式类似于协议处理:存在一种通用机制来查找与正则表达式 ``^(?P<prefix>[a-z]+)://(?P<suffix>.*)$``"
748+ " 相匹配的前缀,如果识别出了 ``prefix``,则 ``suffix`` 会以与前缀相对应的方式来处理并且处理的结果将替代原字符串值。 "
749+ "如果未识别出前缀,则原字符串将保持不变。"
747750
748751#: ../../library/logging.config.rst:526
749752msgid "Access to internal objects"
750- msgstr ""
753+ msgstr "访问内部对象 "
751754
752755#: ../../library/logging.config.rst:528
753756msgid ""
@@ -759,6 +762,9 @@ msgid ""
759762"``handlers``, ``filters`` and ``formatter`` entries will take an object id "
760763"and resolve to the appropriate destination object."
761764msgstr ""
765+ "除了外部对象,有时还需要引用配置中的对象。 这将由配置系统针对它所了解的内容隐式地完成。 例如,在日志记录器或处理程序中表示 ``level`` "
766+ "的字符串值 ``'DEBUG'`` 将被自动转换为值 ``logging.DEBUG``,而 ``handlers``, ``filters`` 和 "
767+ "``formatter`` 条目将接受一个对象 ID 并解析为适当的目标对象。"
762768
763769#: ../../library/logging.config.rst:536
764770msgid ""
@@ -774,6 +780,11 @@ msgid ""
774780"handler. To cater for this, a generic resolution system allows the user to "
775781"specify:"
776782msgstr ""
783+ "但是,对于 :mod:`logging` 模块所不了解的用户自定义对象则需要一种更通用的机制。 例如,考虑 "
784+ ":class:`logging.handlers.MemoryHandler`,它接受一个 ``target`` 参数即其所委托的另一个处理程序。 "
785+ "由于系统已经知道存在该类,因而在配置中,给定的 ``target`` 只需为相应目标处理程序的的对象 ID 即可,而系统将根据该 ID 解析出处理程序。"
786+ " 但是,如果用户定义了一个具有 ``alternate`` 处理程序的 ``my.package.MyHandler``,则配置程序将不知道 "
787+ "``alternate`` 指向的是一个处理程序。 为了应对这种情况,通用解析系统允许用户指定:"
777788
778789#: ../../library/logging.config.rst:558
779790msgid ""
@@ -783,6 +794,9 @@ msgid ""
783794" access by dot or by index, in a similar way to that provided by "
784795"``str.format``. Thus, given the following snippet:"
785796msgstr ""
797+ "字符串字面值 ``'cfg://handlers.file'`` 将按照与 ``ext://`` "
798+ "前缀类似的方式被解析为结果字符串,但查找操作是在配置自身而不是在导入命名空间中进行。 该机制允许按点号或按索引来访问,与 ``str.format`` "
799+ "所提供的方式类似。 这样,给定以下代码段:"
786800
787801#: ../../library/logging.config.rst:576
788802msgid ""
@@ -799,6 +813,13 @@ msgid ""
799813"value consists only of decimal digits, access will be attempted using the "
800814"corresponding integer value, falling back to the string value if needed."
801815msgstr ""
816+ "在该配置中,字符串 ``'cfg://handlers'`` 将解析为带有 ``handlers`` 键的字典,字符串 "
817+ "``'cfg://handlers.email`` 将解析为 ``handlers`` 字典中带有 ``email`` 键的字典,依此类推。 字符串 "
818+ "``'cfg://handlers.email.toaddrs[1]`` 将解析为 ``'dev_team.domain.tld'`` 而字符串 "
819+ "``'cfg://handlers.email.toaddrs[0]'`` 将解析为值 ``'[email protected] '``。 " 820+ "``subject`` 值可以使用 ``'cfg://handlers.email.subject'`` 或者等价的 "
821+ "``'cfg://handlers.email[subject]'`` 来访问。 后一种形式仅在键包含空格或非字母数字类字符的情况下才需要使用。 "
822+ "如果一个索引仅由十进制数码构成,则将尝试使用相应的整数值来访问,如果有必要则将回退为字符串值。"
802823
803824#: ../../library/logging.config.rst:590
804825msgid ""
@@ -809,10 +830,15 @@ msgid ""
809830"``config_dict['handlers']['myhandler']['mykey'][123]``, and fall back to "
810831"``config_dict['handlers']['myhandler']['mykey']['123']`` if that fails."
811832msgstr ""
833+ "给定字符串 ``cfg://handlers.myhandler.mykey.123``,这将解析为 "
834+ "``config_dict['handlers']['myhandler']['mykey']['123']``。 如果字符串被指定为 "
835+ "``cfg://handlers.myhandler.mykey[123]``,系统将尝试从 "
836+ "``config_dict['handlers']['myhandler']['mykey'][123]`` 中提取值,并在尝试失败时回退为 "
837+ "``config_dict['handlers']['myhandler']['mykey']['123']``。"
812838
813839#: ../../library/logging.config.rst:602
814840msgid "Import resolution and custom importers"
815- msgstr ""
841+ msgstr "导入解析与定制导入器 "
816842
817843#: ../../library/logging.config.rst:604
818844msgid ""
0 commit comments