Changeset 816

Show
Ignore:
Timestamp:
08/14/07 16:47:15 (1 year ago)
Author:
mikey
Message:

extracted escaping of logData into a helper method

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/util/log/stubBaseLogData.php

    r388 r816  
    4242     */ 
    4343    protected $logData = array(); 
    44      
     44 
    4545    /** 
    4646     * constructor 
     
    6565                         ); 
    6666    } 
    67      
     67 
    6868    /** 
    6969     * adds data to the log object 
     
    7878    { 
    7979        settype($data, 'string'); 
    80         $this->logData[] = str_replace(chr(13), '', str_replace("\n", '<nl>', str_replace(stubLogData::SEPERATOR, '', $data))); 
     80        $this->logData[] = $this->escapeData($data); 
    8181    } 
    82      
     82 
     83    /** 
     84     * helper method that escapes the data to be logged 
     85     * 
     86     * @param   string  $data 
     87     * @return  string 
     88     */ 
     89    protected function escapeData($data) 
     90    { 
     91        return str_replace(chr(13), '', str_replace("\n", '<nl>', str_replace(stubLogData::SEPERATOR, '', $data))); 
     92    } 
     93 
    8394    /** 
    8495     * returns the whole log data as one line 
     
    90101        return join(stubLogData::SEPERATOR, $this->logData); 
    91102    } 
    92      
     103 
    93104    /** 
    94105     * returns the log level of the log data 
     
    101112        return $this->level; 
    102113    } 
    103      
     114 
    104115    /** 
    105116     * returns the target where the log data should go to