Class Picasa_Logger

Description

A simple logging mechanism for displaying information while debugging a client application.

This class uses the Singleton pattern so that debugging can be turned on once for the entire application.

  • author: Cameron Hinkle
  • version: Version 1.0
  • copyright: Copyright (c) 2007 Cameron Hinkle
  • todo: Add levels of logging and the ability to log to a file.
  • since: Version 3.2
  • license: GNU Public License Version 3

Located in /Picasa/Logger.php (line 16)


	
			
Variable Summary
Method Summary
Picasa_Logger __construct (boolean $enabled)
boolean isEnabled ()
void log (string $msg)
void logIfEnabled (string $msg)
void setEnabled ([boolean $enabled = false])
Variables
static Picasa_Logger $instance = null (line 24)

The logger instance, used for the Singleton pattern.

  • access: private
boolean $enabled (line 32)

Flag to determine whether or not to log statements.

  • access: private
Methods
static method getLogger (line 50)

Public method to get a logger instance. This is to ensure that only one instance is ever created.

  • return: The Logger instance.
  • access: public
static Picasa_Logger getLogger ()
Constructor __construct (line 40)

Constructs a Logger object. Declared as private for Singleton pattern so there is only one instance.

  • access: private
Picasa_Logger __construct (boolean $enabled)
  • boolean $enabled: Determines whether or not to log.
isEnabled (line 76)

Just checks the value of the enabled flag. Could be true or false. If true, log messages will be printed. If false, log messages will be supressed.

  • return: The value of the enabled flag or false if it's not set.
  • access: public
boolean isEnabled ()
log (line 109)

Prints the provided message to the screen followed by a line break.

This is defined as protected so that client applications will use logIfEnabled().

  • todo: Make this method more robust, so that it can log to a file.
  • access: protected
void log (string $msg)
  • string $msg: The message to log.
logIfEnabled (line 94)

Logs a message if logging is currently enabled. If logging is not enabled, the message is supressed.

  • access: public
void logIfEnabled (string $msg)
  • string $msg: The message to log.
setEnabled (line 64)

Sets the flag that determines whether or not to print log messages.

  • access: public
void setEnabled ([boolean $enabled = false])
  • boolean $enabled: The value to set the enabled flag to. true will cause log messages to be printed, false will cause log messages to be supressed. The default is false.

Documentation generated on Tue, 02 Jun 2009 14:51:53 -0700 by phpDocumentor 1.4.1