CI Log Enable 및 Viewer 함수 만들기
CI Log Enable
_system/core/Controller.php 의 __construct() 내부에
$this->output->enable_profiler(true); // true <--> false로 Log를 켜고 끄고 합니다.
logView.php : CI log 및 별도 생성 Log를 같이 볼 수 있도록 한 Viewer
<?php //CI Log view : http://devwww.ipsventures.com/?cfg=logView&what=ci&date=2020-08-20 //IPS Log view : http://devwww.ipsventures.com/?cfg=logView&log=로그명&date=2020-08-20 //------------------------------------------------------------------------------------------------------------------------ // LOG Url = http://devwww.ipsventures.com/?cfg=logView&log=ips_startupMain //------------------------------------------------------------------------------------------------------------------------ $logDate = ___get('date',date('Y-m-d')); $whatLog = ___get('what','tony'); $logAction = ___get('action'); if ($whatLog == 'ci') $logFile = APPPATH.'logs/log-'.$logDate.'.php'; else $logFile = SOL_LOG_DIR.'/'.$_GET['log'].'.'.str_replace("-","",$logDate).'.log.html'; ___debug($logFile); if ($logAction == 'delete') { unlink($logFile); exit; } $data = file_get_contents($logFile); if ($whatLog == 'ci') { $data = str_replace("\n","<br>",$data); } echo $data; |