Sophie

Sophie

distrib > Fedora > 14 > i386 > media > os > by-pkgid > 6f729790553564af57c5ed43405351bc > files > 6

php-ezc-EventLogDatabaseTiein-1.0.2-1.fc13.noarch.rpm

<?php
require_once 'tutorial_autoload.php';
date_default_timezone_set( "UTC" );

// Get the database instance
$db = ezcDbInstance::get();

// Get the log instance
$log = ezcLog::getInstance();

// Create a database writer attached to the database handler and the table "log"
$writer = new ezcLogDatabaseWriter( $db, "log" );

// Specify that log messages will be written to the database
$log->getMapper()->appendRule( new ezcLogFilterRule( new ezcLogFilter, $writer, true ) );

// Write a log entry ( message, severity, source, category )
$log->log( "File '/images/spacer.gif' does not exist.", ezcLog::WARNING, array( "source" => "Application", "category" => "Design" ) );

// Write a log entry ( message, severity, source, category, file, line )
$log->log( "File '/images/spacer.gif' does not exist.", ezcLog::WARNING, array( "source" => "Application", "category" => "Design" ), array( "file" => "/index.php", "line" => 123 ) );

?>