Skip to content

Commit

Permalink
Merge pull request #10 from polyfractal/feature/StaticLogFunctions
Browse files Browse the repository at this point in the history
Add per-level shortcut functions
  • Loading branch information
jbroadway committed Feb 23, 2013
2 parents 969772a + 9264e0c commit ef8efdb
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions lib/Analog/Analog.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,75 @@ private static function write ($struct) {
public static function log ($message, $level = 3) {
return self::write (self::get_struct ($message, $level));
}

/**
* Shortcut method for Analog::log($info, Analog::URGENT)
* Usage:
*
* Analog::urgent ('Debug info');
*/
public static function urgent ($message) {
return self::write (self::get_struct ($message, URGENT));
}

/**
* Shortcut method for Analog::log($info, Analog::ALERT)
* Usage:
*
* Analog::alert ('Debug info');
*/
public static function alert ($message) {
return self::write (self::get_struct ($message, ALERT));
}

/**
* Shortcut method for Analog::log($info, Analog::ERROR)
* Usage:
*
* Analog::alert ('Debug info');
*/
public static function error ($message) {
return self::write (self::get_struct ($message, ERROR));
}

/**
* Shortcut method for Analog::log($info, Analog::WARNING)
* Usage:
*
* Analog::alert ('Debug info');
*/
public static function warning ($message) {
return self::write (self::get_struct ($message, WARNING));
}

/**
* Shortcut method for Analog::log($info, Analog::NOTICE)
* Usage:
*
* Analog::alert ('Debug info');
*/
public static function notice ($message) {
return self::write (self::get_struct ($message, NOTICE));
}

/**
* Shortcut method for Analog::log($info, Analog::INFO)
* Usage:
*
* Analog::alert ('Debug info');
*/
public static function info ($message) {
return self::write (self::get_struct ($message, INFO));
}

/**
* Shortcut method for Analog::log($info, Analog::DEBUG)
* Usage:
*
* Analog::alert ('Debug info');
*/
public static function debug ($message) {
return self::write (self::get_struct ($message, DEBUG));
}

}

0 comments on commit ef8efdb

Please sign in to comment.