cvs: peardoc /en/package logging.xml /en/package/logging log.xml /en/package/logging/log container.xml init.xml log.xml observer.xml
/en/package/logging/log/log attach.xml detach.xml factory.xml notifyall.xml singleton.xml /en/package/logging/log/observer factory.xml
| From: | Martin Jansen | Date: | Wed, 26 Mar 2003 21:44:32 +0000 |
| Subject: | cvs: peardoc /en/package logging.xml /en/package/logging log.xml /en/package/logging/log container.xml init.xml log.xml observer.xml /en/package/logging/log/log attach.xml detach.xml factory.xml notifyall.xml singleton.xml /en/package/logging/log/observer factory.xml |
||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-531@lists.php.net to get a copy of this message | ||
mj Wed Mar 26 16:44:32 2003 EDT
Added files:
/peardoc/en/package/logging log.xml
/peardoc/en/package/logging/log container.xml init.xml log.xml
observer.xml
/peardoc/en/package/logging/log/log attach.xml detach.xml
factory.xml notifyall.xml
singleton.xml
/peardoc/en/package/logging/log/observer factory.xml
Modified files:
/peardoc/en/package logging.xml
Log:
* Add documentation for Log.
Index: peardoc/en/package/logging.xml diff -u peardoc/en/package/logging.xml:1.2 peardoc/en/package/logging.xml:1.3 --- peardoc/en/package/logging.xml:1.2 Mon Mar 10 17:27:39 2003 +++ peardoc/en/package/logging.xml Wed Mar 26 16:44:31 2003 @@ -5,7 +5,8 @@ <para> Provides Packages for logging purposes </para> - + + &package.logging.log; </chapter> <!-- Keep this comment at the end of the file Local variables: Index: peardoc/en/package/logging/log.xml +++ peardoc/en/package/logging/log.xml <!-- $Revision: 1.1 $ --> <sect1 id="package.logging.log"> <title>Log</title> <para> Implements both an abstraction for various logging mechanisms and the Subject end of a Subject-Observer pattern. </para> &package.logging.log.container; &package.logging.log.init; &package.logging.log.log; &package.logging.log.log.factory; &package.logging.log.log.singleton; &package.logging.log.log.attach; &package.logging.log.log.detach; &package.logging.log.log.notifyall; &package.logging.log.observer; &package.logging.log.observer.factory; </sect1> <!-- 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/en/package/logging/log/container.xml +++ peardoc/en/package/logging/log/container.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.container"> <refnamediv> <refname>Logging container</refname> <refpurpose> <classname>Log</classname> supports different types of data containers. </refpurpose> </refnamediv> <refsect1 id="package.logging.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="package.logging.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="package.logging.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="package.logging.log.container.syslog"> <title>'syslog' - 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> <!-- 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/en/package/logging/log/init.xml +++ peardoc/en/package/logging/log/init.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.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> &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>&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/en/package/logging/log/log.xml +++ peardoc/en/package/logging/log/log.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.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> </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/en/package/logging/log/observer.xml +++ peardoc/en/package/logging/log/observer.xml <!-- $Revision: 1.1 $ --> <refentry id="packages.log.observer"> <refnamediv> <refname>Log_Observer</refname> <refpurpose>Log observer class</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>require_once "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> </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/en/package/logging/log/log/attach.xml +++ peardoc/en/package/logging/log/log/attach.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.attach"> <refnamediv> <refname>Log::attach()</refname> <refpurpose> Attach new observer to existing list. </refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef><function>Log::attach</function></funcdef> <paramdef>object <parameter>logObserver</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.logging.log.log.attach.desc"> &title.desc; <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="package.logging.log.log.attach.note"> &title.note; ¬e.notstatic; </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/en/package/logging/log/log/detach.xml +++ peardoc/en/package/logging/log/log/detach.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.detach"> <refnamediv> <refname>Log::detach()</refname> <refpurpose> Detach observer from existing list. </refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef><function>Log::detach</function></funcdef> <paramdef>object <parameter>logObserver</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.logging.log.log.detach.desc"> &title.desc; <para> Removes a <link linkend="package.logging.log.observer">Log_Observer</link> instance from the list of observers. </para> </refsect1> <refsect1 id="package.logging.log.log.detach.note"> &title.note; ¬e.notstatic; </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/en/package/logging/log/log/factory.xml +++ peardoc/en/package/logging/log/log/factory.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.factory"> <refnamediv> <refname>Log::factory()</refname> <refpurpose> Return a concrete Log instance of <parameter>log_type</parameter>. </refpurpose> </refnamediv> <refsynopsisdiv> <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> </refsynopsisdiv> <refsect1 id="package.logging.log.log.factory.desc"> &title.desc; <para> Return a concrete Log instance of <parameter>log_type</parameter>. </para> </refsect1> <refsect1 id="package.logging.log.log.factory.return"> &title.returns; <para> <parameter>object</parameter> - the newly created concrete Log instance, or an false on an error. </para> </refsect1> <refsect1 id="package.logging.log.log.factory.note"> &title.note; ¬e.canstatic; </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/en/package/logging/log/log/notifyall.xml +++ peardoc/en/package/logging/log/log/notifyall.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.notifyall"> <refnamediv> <refname>Log::notifyAll()</refname> <refpurpose> Notify all observers. </refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef><function>Log::notifyAll</function></funcdef> <paramdef>array <parameter>messageOb</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.logging.log.log.notifyall.desc"> &title.desc; <para> Sends any <link linkend="package.logging.log.observer">Log_Observer</link> objects listening to this Log the message that was just logged. </para> </refsect1> <refsect1 id="package.logging.log.log.notifyall.note"> &title.note; ¬e.notstatic; </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/en/package/logging/log/log/singleton.xml +++ peardoc/en/package/logging/log/log/singleton.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.singleton"> <refnamediv> <refname>Log::singleton()</refname> <refpurpose> </refpurpose> </refnamediv> <refsynopsisdiv> <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> </refsynopsisdiv> <refsect1 id="package.logging.log.log.singleton.desc"> &title.desc; <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 = &Log::singleton()</literal>syntax. Without the ampersand (&) in front of the method name, you will not get a reference; you will get a copy. </simpara> </note> </para> </refsect1> <refsect1 id="package.logging.log.log.singleton.return"> &title.returns; <para> <parameter>object</parameter> - the newly created concrete Log instance, or an false on an error. </para> </refsect1> <refsect1 id="package.logging.log.log.singleton.note"> &title.note; ¬e.canstatic; </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/en/package/logging/log/observer/factory.xml +++ peardoc/en/package/logging/log/observer/factory.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.observer.factory"> <refnamediv> <refname>Log_Observer::factory</refname> <refpurpose> Return a concrete Log_Observer instance of <parameter>observer_type</parameter>. </refpurpose> </refnamediv> <refsynopsisdiv> <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> </refsynopsisdiv> <refsect1 id="package.logging.log.observer.factory.desc"> &title.desc; <para> Attempts to return a concrete Log_Observer instance of the specified <parameter>observer_type</parameter>. </para> </refsect1> <refsect1 id="package.logging.log.observer.factory.return"> &title.returns; <para> <parameter>object</parameter> - the newly created concrete Log_Observer instance, or an false on an error. </para> </refsect1> <refsect1 id="package.logging.log.observer.factory.note"> &title.note; ¬e.canstatic; </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/en/package/logging.xml diff -u peardoc/en/package/logging.xml:1.2 peardoc/en/package/logging.xml:1.3 --- peardoc/en/package/logging.xml:1.2 Mon Mar 10 17:27:39 2003 +++ peardoc/en/package/logging.xml Wed Mar 26 16:44:31 2003 @@ -5,7 +5,8 @@ <para> Provides Packages for logging purposes </para> - + + &package.logging.log; </chapter> <!-- Keep this comment at the end of the file Local variables: Index: peardoc/en/package/logging/log.xml +++ peardoc/en/package/logging/log.xml <!-- $Revision: 1.1 $ --> <sect1 id="package.logging.log"> <title>Log</title> <para> Implements both an abstraction for various logging mechanisms and the Subject end of a Subject-Observer pattern. </para> &package.logging.log.container; &package.logging.log.init; &package.logging.log.log; &package.logging.log.log.factory; &package.logging.log.log.singleton; &package.logging.log.log.attach; &package.logging.log.log.detach; &package.logging.log.log.notifyall; &package.logging.log.observer; &package.logging.log.observer.factory; </sect1> <!-- 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/en/package/logging/log/container.xml +++ peardoc/en/package/logging/log/container.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.container"> <refnamediv> <refname>Logging container</refname> <refpurpose> <classname>Log</classname> supports different types of data containers. </refpurpose> </refnamediv> <refsect1 id="package.logging.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="package.logging.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="package.logging.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="package.logging.log.container.syslog"> <title>'syslog' - 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> <!-- 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/en/package/logging/log/init.xml +++ peardoc/en/package/logging/log/init.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.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> &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>&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/en/package/logging/log/log.xml +++ peardoc/en/package/logging/log/log.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.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> </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/en/package/logging/log/observer.xml +++ peardoc/en/package/logging/log/observer.xml <!-- $Revision: 1.1 $ --> <refentry id="packages.log.observer"> <refnamediv> <refname>Log_Observer</refname> <refpurpose>Log observer class</refpurpose> </refnamediv> <refsynopsisdiv> <synopsis>require_once "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> </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/en/package/logging/log/log/attach.xml +++ peardoc/en/package/logging/log/log/attach.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.attach"> <refnamediv> <refname>Log::attach()</refname> <refpurpose> Attach new observer to existing list. </refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef><function>Log::attach</function></funcdef> <paramdef>object <parameter>logObserver</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.logging.log.log.attach.desc"> &title.desc; <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="package.logging.log.log.attach.note"> &title.note; ¬e.notstatic; </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/en/package/logging/log/log/detach.xml +++ peardoc/en/package/logging/log/log/detach.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.detach"> <refnamediv> <refname>Log::detach()</refname> <refpurpose> Detach observer from existing list. </refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef><function>Log::detach</function></funcdef> <paramdef>object <parameter>logObserver</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.logging.log.log.detach.desc"> &title.desc; <para> Removes a <link linkend="package.logging.log.observer">Log_Observer</link> instance from the list of observers. </para> </refsect1> <refsect1 id="package.logging.log.log.detach.note"> &title.note; ¬e.notstatic; </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/en/package/logging/log/log/factory.xml +++ peardoc/en/package/logging/log/log/factory.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.factory"> <refnamediv> <refname>Log::factory()</refname> <refpurpose> Return a concrete Log instance of <parameter>log_type</parameter>. </refpurpose> </refnamediv> <refsynopsisdiv> <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> </refsynopsisdiv> <refsect1 id="package.logging.log.log.factory.desc"> &title.desc; <para> Return a concrete Log instance of <parameter>log_type</parameter>. </para> </refsect1> <refsect1 id="package.logging.log.log.factory.return"> &title.returns; <para> <parameter>object</parameter> - the newly created concrete Log instance, or an false on an error. </para> </refsect1> <refsect1 id="package.logging.log.log.factory.note"> &title.note; ¬e.canstatic; </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/en/package/logging/log/log/notifyall.xml +++ peardoc/en/package/logging/log/log/notifyall.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.notifyall"> <refnamediv> <refname>Log::notifyAll()</refname> <refpurpose> Notify all observers. </refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef><function>Log::notifyAll</function></funcdef> <paramdef>array <parameter>messageOb</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.logging.log.log.notifyall.desc"> &title.desc; <para> Sends any <link linkend="package.logging.log.observer">Log_Observer</link> objects listening to this Log the message that was just logged. </para> </refsect1> <refsect1 id="package.logging.log.log.notifyall.note"> &title.note; ¬e.notstatic; </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/en/package/logging/log/log/singleton.xml +++ peardoc/en/package/logging/log/log/singleton.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.log.singleton"> <refnamediv> <refname>Log::singleton()</refname> <refpurpose> </refpurpose> </refnamediv> <refsynopsisdiv> <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> </refsynopsisdiv> <refsect1 id="package.logging.log.log.singleton.desc"> &title.desc; <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 = &Log::singleton()</literal>syntax. Without the ampersand (&) in front of the method name, you will not get a reference; you will get a copy. </simpara> </note> </para> </refsect1> <refsect1 id="package.logging.log.log.singleton.return"> &title.returns; <para> <parameter>object</parameter> - the newly created concrete Log instance, or an false on an error. </para> </refsect1> <refsect1 id="package.logging.log.log.singleton.note"> &title.note; ¬e.canstatic; </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/en/package/logging/log/observer/factory.xml +++ peardoc/en/package/logging/log/observer/factory.xml <!-- $Revision: 1.1 $ --> <refentry id="package.logging.log.observer.factory"> <refnamediv> <refname>Log_Observer::factory</refname> <refpurpose> Return a concrete Log_Observer instance of <parameter>observer_type</parameter>. </refpurpose> </refnamediv> <refsynopsisdiv> <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> </refsynopsisdiv> <refsect1 id="package.logging.log.observer.factory.desc"> &title.desc; <para> Attempts to return a concrete Log_Observer instance of the specified <parameter>observer_type</parameter>. </para> </refsect1> <refsect1 id="package.logging.log.observer.factory.return"> &title.returns; <para> <parameter>object</parameter> - the newly created concrete Log_Observer instance, or an false on an error. </para> </refsect1> <refsect1 id="package.logging.log.observer.factory.note"> &title.note; ¬e.canstatic; </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 -->