cvs: peardoc / manual.xml.in /en/core log.xml /en/packages log.xml

From: Date: Sat, 09 Feb 2002 14:06:08 +0000
Subject: cvs: peardoc / manual.xml.in /en/core log.xml /en/packages log.xml
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2342@lists.php.net to get a copy of this message
mj Sat Feb 9 09:06:08 2002 EDT Added files: /peardoc/en/packages log.xml Removed files: /peardoc/en/core log.xml Modified files: /peardoc manual.xml.in Log: * Move log documentation away from core.

Index: peardoc/manual.xml.in diff -u peardoc/manual.xml.in:1.18 peardoc/manual.xml.in:1.19 --- peardoc/manual.xml.in:1.18 Fri Feb 8 03:12:25 2002 +++ peardoc/manual.xml.in Sat Feb 9 09:06:05 2002 @@ -40,7 +40,6 @@ &core.console; &core.db; &core.http; - &core.log; &core.mail; &core.networking; &core.system; @@ -50,6 +49,7 @@ <title>&Packages;</title> &packages.authentication; &packages.file; + &packages.log; &packages.networking; &packages.templates; &packages.xml; Index: peardoc/en/packages/log.xml +++ peardoc/en/packages/log.xml <?xml encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <reference id="packages.log"> <title>Logging</title> <titleabbrev>PEAR Log</titleabbrev> <partintro> <simpara> </simpara> </partintro> <refentry id="packages.log.container"> <refnamediv> <refname>Logging container</refname> <refpurpose><classname>Log</classname> supports different types of data containers.</refpurpose> </refnamediv> <refsect1 id="packages.log.container.file"> <title>'file' - Log_file</title> <para> Stores data in an arbitrary file on a local file system (local refers to any file accessible using PHP's filesystem functions). </para> </refsect1> <refsect1 id="packages.log.container.mcal"> <title>'mcal' - Log_mcal</title> <para> Stores data in a calendar application. This requires the <command>libmcal</command> and <command>mcal</command> PHP extensions. </para> </refsect1> <refsect1 id="packages.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="packages.log.container.syslog"> <title>'sql' - Log_syslog</title> <para> Stores data using <command>syslog</command> on Unix-based systems or in the <command>Event Log</command> on Windows NT/2000/XP. </para> </refsect1> </refentry> <refentry id="packages.log.init"> <refnamediv> <refname>Initialization</refname> <refpurpose>Creating a <classname>Log</classname> object</refpurpose> </refnamediv> <refsect1> <title></title> <para> There are three possible methods to create a <classname>Log</classname> object. You can create a <classname>Log_</classname> object directly or call either the <link linkend="packages.log.log.singleton"><function> &amp;singleton</function></link> or the <link linkend="packages.log.log.factory"><function>factory</function> </link> method of the <classname>Log</classname> class. </para> <example> <title>Initialization 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 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> <refentry id="packages.log.log"> <refnamediv> <refname>Log</refname> <refpurpose>Logging abstraction class</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>require_once "Log.php";</synopsis> </refsynopsisdiv> <refsect1> <title>Description</title> <simpara> Logging interface functions. </simpara> </refsect1> <refsect1 id="packages.log.log.factory"> <title>Log::factory</title> <funcsynopsis> <funcprototype> <funcdef>object <function>Log::factory</function></funcdef> <paramdef>string <parameter>log_type</parameter></paramdef> <paramdef>string <parameter><optional>log_name</optional></parameter></paramdef> <paramdef>string <parameter><optional>ident</optional></parameter></paramdef> <paramdef>array <parameter><optional>conf</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Return a concrete Log instance of <parameter>log_type</parameter>. </para> </refsect1> <refsect1 id="packages.log.log.singleton"> <title>Log::singleton</title> <funcsynopsis> <funcprototype> <funcdef>object <function>Log::singleton</function></funcdef> <paramdef>string <parameter>log_type</parameter></paramdef> <paramdef>string <parameter><optional>log_name</optional></parameter></paramdef> <paramdef>string <parameter><optional>ident</optional></parameter></paramdef> <paramdef>array <parameter><optional>conf</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns a reference to a concrete Log instance of <parameter>log_type</parameter>, only creating a new instance if no Log instance with the same parameters currently exists. </para> <para> You should use this if there are multiple places you might create a logger, you don't want to create multiple loggers, and you don't want to check for the existance of one each time. The singleton pattern does all the checking work for you. </para> <para> <note> <simpara> You MUST call this method with the <literal>$var = &amp;Log::singleton() </literal>syntax. Without the ampersand (&amp;) in front of the method name, you will not get a reference; you will get a copy. </simpara> </note> </para> </refsect1> <refsect1 id="packages.log.log.attach"> <title>Log::attach</title> <funcsynopsis> <funcprototype> <funcdef><function>Log::attach</function></funcdef> <paramdef>object <parameter>logObserver</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Adds a <link linkend="packages.log.observer">Log_Observer</link> instance to the list of observers that are to be notified when a message is logged. </para> </refsect1> <refsect1 id="packages.log.log.detach"> <title>Log::detach</title> <funcsynopsis> <funcprototype> <funcdef><function>Log::detach</function></funcdef> <paramdef>object <parameter>logObserver</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Removes a <link linkend="packages.log.observer">Log_Observer</link> instance from the list of observers. </para> </refsect1> <refsect1 id="packages.log.log.notifyall"> <title>Log::notifyAll</title> <funcsynopsis> <funcprototype> <funcdef><function>Log::notifyAll</function></funcdef> <paramdef>array <parameter>messageOb</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Sends any <link linkend="packages.log.observer">Log_Observer</link> objects listening to this Log the message that was just logged. </para> </refsect1> </refentry> <refentry id="packages.log.observer"> <refnamediv> <refname>Log_Observer</refname> <refpurpose>Log observer class</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>require_once "Log/Log_Observer.php";</synopsis> </refsynopsisdiv> <refsect1> <title>Description</title> <simpara> The Log_Observer class implements the Observer end of a Subject-Observer pattern for watching log activity and taking actions when notable events occur. </simpara> </refsect1> <refsect1 id="packages.log.observer.factory"> <title>Log_Observer::factory</title> <funcsynopsis> <funcprototype> <funcdef>object <function>Log_Observer::factory</function></funcdef> <paramdef>string <parameter>observer_type</parameter></paramdef> <paramdef>integer <parameter><optional>priority</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Attempts to return a concrete Log_Observer instance of the specified <parameter>observer_type</parameter>. </para> </refsect1> </refentry> </reference> <!-- 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.cvs (#2342) next »