Overview

Namespaces

  • None
  • PHP
  • Pry
    • Auth
      • Interfaces
    • Config
    • Controller
    • Date
    • Db
    • Feed
      • Abstracts
      • Writers
    • File
      • Decorator
    • Form
      • Element
    • Image
    • Log
      • Writer
    • Net
      • Exception
    • Session
    • Util
    • Validate
      • Validator
    • View

Classes

  • Bd
  • File
  • Syslog
  • WriterAbstract
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * Pry Framework
  5:  *
  6:  * LICENSE
  7:  *
  8:  * This source file is subject to the new BSD license that is bundled
  9:  * with this package in the file LICENSE.txt.
 10:  * 
 11:  */
 12: 
 13: namespace Pry\Log\Writer;
 14: 
 15: /**
 16:  *
 17:  * @package Log
 18:  * @subpackage Log_Writer
 19:  * @abstract 
 20:  * @version 1.1.1
 21:  * @author Olivier ROGER <oroger.fr>
 22:  *       
 23:  */
 24: abstract class WriterAbstract
 25: {
 26: 
 27:     const EMERGENCY = 0;
 28:     const ALERT     = 1;
 29:     const CRITICAL  = 2;
 30:     const ERROR     = 3;
 31:     const WARN      = 4;
 32:     const NOTICE    = 5;
 33:     const INFO      = 6;
 34:     const DEBUG     = 7;
 35:     const MODE_MINI = 0; // Uniquement le message
 36:     const MODE_FULL = 1; // Lvl,date,message
 37:     const DAILY     = 1;
 38:     const MONTHLY   = 2;
 39: 
 40:     /**
 41:      * Durée des fichiers logs
 42:      *
 43:      * @var int
 44:      * @access protected
 45:      */
 46:     protected $duree = self::MONTHLY;
 47: 
 48:     /**
 49:      * Correspondance textuel des niveaux de sévérité
 50:      * @var array
 51:      */
 52:     protected $txtSeverity = array('emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info', 'debug');
 53: 
 54:     /**
 55:      * Type des messages
 56:      * mini = juste le message , full = message + date + level
 57:      * @var int
 58:      * @access protected
 59:      */
 60:     protected $mode = self::MODE_FULL;
 61: 
 62:     /**
 63:      * Ecriture du message
 64:      *
 65:      * @param string $message
 66:      * @param int $level
 67:      * @access public
 68:      */
 69:     public function write($message, $level = self::INFO)
 70:     {
 71:         $this->_write($message, $level);
 72:     }
 73: 
 74:     /**
 75:      * Défini la durée des fichiers de logs
 76:      *
 77:      * @param int $duree
 78:      */
 79:     public function setDuration($duree)
 80:     {
 81:         $this->duree = intval($duree);
 82:     }
 83: 
 84:     /**
 85:      * Défini le mode de message
 86:      *
 87:      * @param int $mode
 88:      */
 89:     public function setMode($mode)
 90:     {
 91:         $this->mode = intval($mode);
 92:     }
 93: 
 94:     /**
 95:      * Défini le préfixe des fichiers
 96:      *
 97:      * @return string
 98:      */
 99:     protected function getPrefixe()
100:     {
101:         if ($this->duree == self::DAILY)
102:             return date("d-m-Y") . '_';
103:         elseif ($this->duree == self::MONTHLY)
104:             return date("m-Y") . '_';
105:         else
106:             return '';
107:     }
108: 
109:     abstract protected function _write($message, $level);
110: }
Pry API documentation generated by ApiGen 2.8.0