cvs: peardoc /ja/package/logging/log examples.xml init.xml log.xml

From: Date: Mon, 20 Oct 2003 02:01:00 +0000
Subject: cvs: peardoc /ja/package/logging/log examples.xml init.xml log.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-1692@lists.php.net to get a copy of this message
cellog Sun Oct 19 22:01:00 2003 EDT Added files: /peardoc/ja/package/logging/log examples.xml init.xml log.xml Log: move yet another incorrect commit of en/ to ja/ Index: peardoc/ja/package/logging/log/examples.xml +++ peardoc/ja/package/logging/log/examples.xml <!-- $Revision: 1.1 $ --> <!-- Sync 1.2 --> <refentry id="package.logging.log.examples"> <refnamediv> <refname>例</refname> <refpurpose> <classname>Log</classname>クラスの使い方 </refpurpose> </refnamediv> <refsect1> <title>ファイルに記録する</title> <example> <title></title> <para> 次のコード例では、ログメッセージがすべて <filename>user.log</filename> に書かれています。 </para> <programlisting role="php"> <![CDATA[ <?php require_once 'Log.php'; $conf = array('mode' => 0600, 'timeFormat' => '%X %x'); $log = &Log::singleton('file', '/tmp/out1.log', 'test1', $conf, LOG_INFO); for ($i = 0; $i < 12; $i++) { $log->log("Foo: $i", LOG_INFO); } $log->close(); ?> ]]> </programlisting> </example> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: peardoc/ja/package/logging/log/init.xml +++ peardoc/ja/package/logging/log/init.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.2 --> <refentry id="package.logging.log.init"> <refnamediv> <refname>初期化</refname> <refpurpose><classname>Log</classname>オブジェクトの作成</refpurpose> </refnamediv> <refsect1> <title></title> <para> <classname>Log</classname> オブジェクトを作成するには3つの可能な方法があります。 直接<classname>Log</classname>オブジェクトを作成する方法か、 <link linkend="package.logging.log.log.singleton"> <classname>Log</classname>の<function>&amp;singleton</function></link>または <link linkend="package.logging.log.log.factory"><function>factory</function> </link>関数を呼ぶ方法です。 </para> <example> <title>初期化例</title> <programlisting role="php"> <![CDATA[ // direct initialization of the 'file' container $log = new Log_file('log.txt', 'identity text'); // initialization of the 'file' container through factory() $log = &Log::factory('file', 'log.txt', 'identity text'); // initialization of the 'file' container through singleton() $log = &Log::singleton('file', 'log.txt', 'identity text'); ]]> </programlisting> </example> <para> Directly initializing an instance of the <classname>Log</classname> is probably the easiest method to understand. </para> <para> The second two approaches make use of software engineering design patterns (the "factory" and "singleton" metaphors). </para> <para> Specifically, calling the <function>factory</function> method will create a new instance of one of the <classname>Log_</classname> subclasses. The type of subclass that is returned is specified by the first parameter (<parameter>log_type</parameter>) passed to the <function>factory</function> method. This approach effectively hides the subclasses while still allowing the programmer to request a concrete instance of a certain subclass. This is useful in cases where the subclass type needs to be chosen at runtime. </para> <para> The <function>factory</function> method must always be called using PHP's static method notation - <literal>Log::factory</literal>. </para> <para> The <function>singleton</function> method is identical to the <function>factory</function> method except that it guarantees that only a single instance of the requested <classname>Log_</classname> subclass exists. The <function>singleton</function> method bases each instance's uniqueness on the parameters used in the instance's creation. In other words, only one instance with a given set of creation parameters will ever be returned by the <function>singleton</function> method. The second invocation will simply return a reference to the existing instance. </para> <para> The <function>singleton</function> method must also be called statically. In addition, it requires PHP's reference notation - <literal>&amp;Log::singleton</literal>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> Index: peardoc/ja/package/logging/log/log.xml +++ peardoc/ja/package/logging/log/log.xml <!-- $Revision: 1.1 $ --> <!-- Sync: 1.1 --> <refentry id="package.logging.log.log"> <refnamediv> <refname>Log</refname> <refpurpose>ロギング抽象クラス</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>require_once "Log.php";</synopsis> </refsynopsisdiv> <refsect1> <title>Description</title> <simpara> ロギングインターフェース関数。 </simpara> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->

« previous php.pear.doc (#1692) next »