cvs: peardoc /ja/package/logging/log examples.xml init.xml log.xml
| From: | Greg Beaver | 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>&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>&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
-->