util 
[ doc home ] [ class tree: util ] [ index: util ] [ all elements ]

Class: IsterLoggerMysql

Source Location: /IsterLoggerMysql.php

Class Overview

IsterLogger
   |
   --IsterLoggerMysql

This class represents a log writer.


Author(s): Ingo Schramm   

Copyright: Copyright (c) 2005 Ister.ORG Ingo Schramm

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterLogger

IsterLogger::IsterLogger()
Constructor
IsterLogger::getLevelStr()
Return a string representation of the log level.
IsterLogger::log()
Print the log message.
IsterLogger::setup()
Setup the logger.

Class Details

This class represents a log writer.

Before you can use the logger you must call setupLogger (usually on your application object) to establish a connection.

  1. CREATE TABLE logs (
  2. id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  3. time TIMESTAMP NOT NULL DEFAULT 'now()',
  4. level ENUM('notice', 'warning', 'error', 'debug') NOT NULL,
  5. caller VARCHAR(255) NOT NULL,
  6. context VARCHAR(255) NOT NULL,
  7. msg TEXT NOT NULL,
  8. rusage VARCHAR(32) NULL,
  9. PRIMARY KEY(id)
  10. );
  11. --
  12. $o = new IsterObject()
  13. $o->setLogger('IsterLoggerMysql');
  14. $o->setupLogger('IsterLoggerMysql',
  15. array('host' => '<localhost>',
  16. 'user' => '<testuser>',
  17. 'pass' => '<testpass>',
  18. 'db' => '<test>',
  19. 'table' => 'logs',
  20. 'loglevel' => E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE,
  21. 'rusage' => false));


copyright:  Copyright (c) 2005 Ister.ORG Ingo Schramm
author:  Ingo Schramm


[ Top ]


Class Methods


constructor IsterLoggerMysql

IsterLoggerMysql IsterLoggerMysql( )

Constructor

[ Top ]

method log

integer log( mixed $msg, mixed $level, mixed $caller, [mixed $context = null])

Write a log entry.

If no connection is active, log() will return silently. The logging table must already exist.


Overrides IsterLogger::log() (Print the log message.)

[ Top ]

method setup

void setup( array $array)

Setup the logger.

Overrides IsterLogger::setup() (Setup the logger.)

Parameters:

array   $array   An array cntaining setup data.

[ Top ]


Documentation generated on Tue, 20 Dec 2005 11:20:56 +0100 by phpDocumentor 1.3.0RC4