* @package zin * @version $Id * @link https://www.zentao.net */ namespace zin\utils; $logs = array(); function log($type, $msg = null, $file) { global $config, $logs; if(!$config->debug) return; if($msg === null) { $msg = $type; $type = 'i'; } if(is_array($msg)) { $msgLines = array(); foreach($msg as $m) $msgLines[] = strval($m); $msg = implode(' ', $msgLines); } else { $msg = strval($msg); } $logs[] = array(array('type' => strtolower($type), 'msg' => $msg)); } function logInfo($msg, $file = null) {log('i', $msg, $file);}; function logWarn($msg, $file = null) {log('w', $msg, $file);}; function logError($msg, $file = null) {log('e', $msg, $file);};