<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 327994 $ -->

<phpdoc:classref xml:id="class.mongolog" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

 <title>The MongoLog class</title>
 <titleabbrev>MongoLog</titleabbrev>

 <partintro>

<!-- {{{ MongoLog intro -->
  <section xml:id="mongolog.intro">
   &reftitle.intro;
   <para>
    Logging can be used to get detailed information about what the driver is
    doing. The logging mechanism as used by MongoLog emits all log messages
    as a PHP notice. Depending on the server interface that you use,
    that means that they will either be sent to strerr (with PHP-CLI), or
    otherwise to the web server's error log. In order for log messages to
    be output by PHP their level (E_NOTICE) does need to be configured to
    be shown. That means the E_NOTICE bit needs to be part of PHP's
    error_reporting level and that display_errors is set to 1.
   </para>
   <para>
    Logging is turned off, by default. This class allows you to turn on
    specific levels of logging for specific parts of the driver. Some examples:
   </para>
   <programlisting role="php">
<![CDATA[
<?php

// print every log message possible
MongoLog::setLevel(MongoLog::ALL); // all log levels
MongoLog::setModule(MongoLog::ALL); // all parts of the driver

// print significant events about replica set failover
MongoLog::setLevel(MongoLog::INFO);
MongoLog::setModule(MongoLog::RS);

// print info- and server tuning-level events from replica sets and connection pooling
MongoLog::setLevel(MongoLog::INFO|MongoLog::FINE);
MongoLog::setModule(MongoLog::RS|MongoLog::POOL);

?>
]]>
   </programlisting>
  </section>
<!-- }}} -->

  <section xml:id="mongolog.synopsis">
   &reftitle.classsynopsis;

<!-- {{{ Synopsis -->
   <classsynopsis>
    <ooclass><classname>MongoLog</classname></ooclass>

<!-- {{{ Class synopsis -->
    <classsynopsisinfo>
     <ooclass>
      <classname>MongoLog</classname>
     </ooclass>
    </classsynopsisinfo>
<!-- }}} -->

    <classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.none">MongoLog::NONE</varname>
     <initializer>0</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.all">MongoLog::ALL</varname>
     <initializer>31</initializer>
    </fieldsynopsis>

    <classsynopsisinfo role="levels">level constants</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.warning">MongoLog::WARNING</varname>
     <initializer>1</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.info">MongoLog::INFO</varname>
     <initializer>2</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.fine">MongoLog::FINE</varname>
     <initializer>4</initializer>
    </fieldsynopsis>

    <classsynopsisinfo role="levels">module constants</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.rs">MongoLog::RS</varname>
     <initializer>1</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.pool">MongoLog::POOL</varname>
     <initializer>2</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.io">MongoLog::IO</varname>
     <initializer>4</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.server">MongoLog::SERVER</varname>
     <initializer>8</initializer>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>const</modifier>
     <type>int</type>
     <varname linkend="mongolog.constants.parse">MongoLog::PARSE</varname>
     <initializer>16</initializer>
    </fieldsynopsis>

    <classsynopsisinfo role="comment">Fields</classsynopsisinfo>
    <fieldsynopsis>
     <modifier>public</modifier>
     <modifier></modifier>
     <type>int</type>
     <varname>level</varname>
    </fieldsynopsis>
    <fieldsynopsis>
     <modifier>public</modifier>
     <type>int</type>
     <varname>module</varname>
    </fieldsynopsis>

    <classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
    <xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongolog')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
   </classsynopsis>
<!-- }}} -->

  </section>

  <section>
   &reftitle.constants;
   <section xml:id="mongolog.constants.types">
    <title>MongoLog Constants</title>
    <para>
     These constants can be used by both
     <function>MongoLog::setLevel</function> and
     <function>MongoLog::setModule</function>.
    </para>

    <variablelist>
     <varlistentry xml:id="mongolog.constants.none">
      <term><constant>MongoLog::NONE</constant></term>
      <listitem>
       <simpara>
        Constant for turning logging off.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongolog.constants.all">
      <term><constant>MongoLog::ALL</constant></term>
      <listitem>
       <simpara>
        Constant for logging everything.
       </simpara>
      </listitem>
     </varlistentry>
    </variablelist>
   </section>

   <section xml:id="mongolog.constants.level">
    <title>MongoLog Level Constants</title>
    <para>
     These constants can be used by <function>MongoLog::setLevel</function>.
    </para>
    <variablelist>
     <varlistentry xml:id="mongolog.constants.warning">
      <term><constant>MongoLog::WARNING</constant></term>
      <listitem>
       <simpara>
        This will print log messages about somewhat exceptional but
        not-quite-exception-worthy happenings.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongolog.constants.info">
      <term><constant>MongoLog::INFO</constant></term>
      <listitem>
       <simpara>
        Logs events that may be of interest to administrators, but are not
        particularly noteworthy.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongolog.constants.fine">
      <term><constant>MongoLog::FINE</constant></term>
      <listitem>
       <simpara>
        Logs most events that the driver performs. Depending on the module being
        logged, this can be extremely noisy and is primarily for debugging.
       </simpara>
      </listitem>
     </varlistentry>
    </variablelist>
   </section>

   <section xml:id="mongolog.constants.module">
    <title>MongoLog Module Constants</title>
    <para>
     These constants can be used by <function>MongoLog::setModule</function>.
    </para>
    <variablelist>
     <varlistentry xml:id="mongolog.constants.io">
      <term><constant>MongoLog::IO</constant></term>
      <listitem>
       <simpara>
        Logs traffic to/from the database. Unless your program is trivial, this
        will create an enormous number of log messages.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongolog.constants.parse">
      <term><constant>MongoLog::PARSE</constant></term>
      <listitem>
       <simpara>
        Log server string parsing.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongolog.constants.pool">
      <term><constant>MongoLog::POOL</constant></term>
      <listitem>
       <simpara>
        Log connection pool activity. Creating new connections, reusing
        connections, and closing connections.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongolog.constants.rs">
      <term><constant>MongoLog::RS</constant></term>
      <listitem>
       <simpara>
        Log replica set activity. Failovers, pinging, chosing secondaries to
        read from, etc.
       </simpara>
      </listitem>
     </varlistentry>
     <varlistentry xml:id="mongolog.constants.server">
      <term><constant>MongoLog::SERVER</constant></term>
      <listitem>
       <simpara>
        Log server status changes. Detecting primary, secondary and
        duplication detection.
       </simpara>
      </listitem>
     </varlistentry>
    </variablelist>
   </section>
  </section>

 </partintro>

 &reference.mongo.entities.mongolog;

</phpdoc:classref>

<!-- 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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/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
-->
