cvs: peardoc /en/core log.xml

From: Date: Sun, 13 Jan 2002 14:51:47 +0000
Subject: cvs: peardoc /en/core log.xml
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1921@lists.php.net to get a copy of this message
alexmerz Sun Jan 13 09:51:47 2002 EDT Modified files: /peardoc/en/core log.xml Log: Add explanation about init and containers Index: peardoc/en/core/log.xml diff -u peardoc/en/core/log.xml:1.1 peardoc/en/core/log.xml:1.2 --- peardoc/en/core/log.xml:1.1 Sat Jan 5 18:49:08 2002 +++ peardoc/en/core/log.xml Sun Jan 13 09:51:47 2002 @@ -1,6 +1,6 @@ <?xml encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> - <reference id="log"> +<!-- $Revision: 1.2 $ --> + <reference id="core.log"> <title>Logging functions</title> <titleabbrev>PEAR Log</titleabbrev> @@ -8,6 +8,98 @@ <simpara> </simpara> </partintro> + + <refentry id="core.log.container"> + <refnamediv> + <refname>Logging container</refname> + <refpurpose> <classname>Log</classname> support different types of data + container.</refpurpose> + </refnamediv> + + <refsect1 id="core.log.container.file"> + <title>'file' - Log_file</title> + <para> + Stores data in an arbitrary file on a local disk. Local means + reachable through filesystem functions. + </para> + </refsect1> + + <refsect1 id="core.log.container.mcal"> + <title>'mcal' - Log_mcal</title> + <para> + Stores data in an calendar application. This requires an installed + <command>libmcal</command> and <command>MCal</command>-PHP-Extension + </para> + </refsect1> + + <refsect1 id="core.log.container.sql"> + <title>'sql' - Log_sql</title> + <para> + Stores data in a database using <link linkend="core.db">PEAR::DB</link> + </para> + </refsect1> + + <refsect1 id="core.log.container.syslog"> + <title>'sql' - Log_sql</title> + <para> + Stores data in the <command>syslog</command> on Unix-based systems or + in the <command>Event Log</command> on Windows NT/2000. + </para> + </refsect1> + </refentry> + + <refentry id="core.log.init"> + <refnamediv> + <refname>Initialization</refname> + <refpurpose>Creating a log object</refpurpose> + </refnamediv> + <refsect1> + <title></title> + <para> + There are three possibilities to get a + <classname>Log</classname>-object. Either you create a + <classname>Log_*</classname>-object directly or you use the + <link linkend="core.log.log.singelton"><function>&amp;singelton + </function> + </link> or + <link linkend="core.log.log.factory"><function>factory</function></link> + function of <classname>Log</classname> + </para> + <example> + <title>init examples</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 singelton() +$log = &Log::singelton( "file", "log.txt", "identity text") ; + ]]> + </programlisting> + </example> + <para> + The direct initialization should be easy to understand, like that the + initialization is probably assertion needy with the help of the + <function>factory</function> and <function>singelton</function> methods. + This both are so called "software design patterns", don't care about + the (maybe) strange kind of creating an object. The + <parameter>$log</parameter> variable contains a regular log container + instance during successful execution. + </para> + <para> + <function>Singelton</function> brings some advantages opposite + the direct initialization with itself. This function provides a + abstraction from the used data container. Further this function checks + whether an appropriate object was already created. Is this the case the + reference of the existing instance is returned, instead of producing a + new. In a large application, this avoids having more then one instance + for the same container with maybe mutual locking. + </para> + </refsect1> + </refentry> <refentry id="core.log.log"> <refnamediv>

« previous php.pear.cvs (#1921) next »