Update logger.php

This commit is contained in:
Namhyeon Go 2019-05-25 20:33:07 +09:00 committed by GitHub
parent 4819a19eac
commit bcec63fb8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@
if(!check_function_exists("write_visit_log")) {
function write_visit_log() {
$fw = false;
if(loadHelper("networktool")) {
$data = DOC_EOL . json_encode(get_network_event());
$fw = append_storage_file($data, array(
@ -23,12 +24,25 @@ if(!check_function_exists("write_visit_log")) {
}
if(!check_function_exists("write_common_log")) {
function write_common_log($msg) {
$msg = DOC_EOL . $msg;
return append_storage_file($msg, array(
function write_common_log($message, $type="None", $forward_to = "") {
$fw = false;
$forwards = explode(",", $forward_to);
$datetime = get_current_datetime();
$data = implode("\t", $datetime, $type, $msg);
$fw = append_storage_file($data, array(
"storage_type" => "logs",
"filename" => "common.log",
"chmod" => 0644,
));
// forwarding to messenger networks
if(count($forwards) > 0 && loadHelper("webhooktool")) {
foreach($forwards as $nw) {
@send_web_hook($message, $nw);
}
}
return $fw;
}
}