Update logger.php
This commit is contained in:
parent
08ccf30f8e
commit
2eae693cb1
|
@ -5,27 +5,32 @@
|
||||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
* @author Go Namhyeon <gnh1201@gmail.com>
|
||||||
* @brief Logger module for ReasonableFramework
|
* @brief Logger module for ReasonableFramework
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(!check_function_exists("write_log_to_file")) {
|
||||||
|
function write_log_to_file($data, $filename) {
|
||||||
|
return append_storage_file($data, array(
|
||||||
|
"storage_type" => "logs",
|
||||||
|
"filename" => $filename,
|
||||||
|
"chmod" => 0644,
|
||||||
|
"nl" => "<",
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!check_function_exists("write_visit_log")) {
|
if(!check_function_exists("write_visit_log")) {
|
||||||
function write_visit_log() {
|
function write_visit_log() {
|
||||||
$fw = false;
|
$fw = false;
|
||||||
$data = "";
|
|
||||||
|
|
||||||
if(loadHelper("networktool")) {
|
|
||||||
$event = get_network_event();
|
|
||||||
|
|
||||||
|
$data = "";
|
||||||
|
if(loadHelper("networktool")) {
|
||||||
|
$nevt = get_network_event();
|
||||||
if(loadHelper("catsplit.format")) {
|
if(loadHelper("catsplit.format")) {
|
||||||
$data = catsplit_encode($event);
|
$data = catsplit_encode($nevt);
|
||||||
} else {
|
} else {
|
||||||
$data = json_encode($event);
|
$data = json_encode($nevt);
|
||||||
}
|
}
|
||||||
|
|
||||||
$fw = append_storage_file($data, array(
|
$fw = write_log_to_file($data, "network.log");
|
||||||
"storage_type" => "logs",
|
|
||||||
"filename" => "network.log",
|
|
||||||
"chmod" => 0644,
|
|
||||||
"nl" => "<",
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fw;
|
return $fw;
|
||||||
|
@ -37,12 +42,7 @@ if(!check_function_exists("write_common_log")) {
|
||||||
$fw = false;
|
$fw = false;
|
||||||
|
|
||||||
$data = implode("\t", array(get_current_datetime(), $type, $msg));
|
$data = implode("\t", array(get_current_datetime(), $type, $msg));
|
||||||
$fw = append_storage_file($data, array(
|
$fw = write_log_to_file($data, "common.log");
|
||||||
"storage_type" => "logs",
|
|
||||||
"filename" => "common.log",
|
|
||||||
"chmod" => 0644,
|
|
||||||
"nl" => "<",
|
|
||||||
));
|
|
||||||
|
|
||||||
// send to networks
|
// send to networks
|
||||||
$_networks = explode(",", $networks);
|
$_networks = explode(",", $networks);
|
||||||
|
@ -55,3 +55,12 @@ if(!check_function_exists("write_common_log")) {
|
||||||
return $fw;
|
return $fw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!check_function_exists("write_debug_log")) {
|
||||||
|
function write_debug_log($msg, $type="None") {
|
||||||
|
if(APP_DEVELOPMENT !== false) {
|
||||||
|
$data = implode("\t", array(get_current_datetime(), $type, $msg));
|
||||||
|
return write_log_to_file($data, "debug.log");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user