오늘만살자

나만의 로그 남기기 본문

Php/Codeigniter

나만의 로그 남기기

오늘만살자 2017. 11. 30. 11:46

codeigniter 3.x 기준


application/config/config.php


234번 라인

$config['log_threshold'] = 5; 


system/core/Log.php


105번 라인

protected $_levels = array('ERROR' => 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4, 'MYLOG'=>5);


대략 170번 라인쯤

if( $this->_levels[$level] < 5 ) {    //추가

  return FALSE;

}


if (( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold))

&& ! isset($this->_threshold_array[$this->_levels[$level]]))

{

return FALSE;

}


로그를 남기고 싶은 라인에

log_message('MYLOG' ,'로그 남기길 내용');


기본적으로 application/logs 에 기록이 남겨진다. 

파일이 생기 않을때는 

chmod 777 application/logs 로 퍼미션을 조절한다. 



Comments