Log File Clasification

This commit is contained in:
JonatanRek 2020-05-20 09:07:27 +02:00
parent 7af1eda141
commit b8b81626e8
3 changed files with 7 additions and 7 deletions

View File

@ -44,7 +44,7 @@ class ErrorHandler {
];
echo json_encode($message);
$apiLogManager = new LogManager('../logs/'. date("Y-m-d").'.log');
$apiLogManager = new LogManager('../logs/apache/'. date("Y-m-d").'.log');
$apiLogManager->write("[APACHE] ERROR\n" . json_encode($message, JSON_PRETTY_PRINT), LogRecordType::INFO);
}
}
@ -53,7 +53,7 @@ set_exception_handler("ErrorHandler::exception");
$json = file_get_contents('php://input');
$obj = json_decode($json, true);
$apiLogManager = new LogManager('../logs/api/HA/'. date("Y-m-d").'.log');
$apiLogManager = new LogManager('../logs/api/'. date("Y-m-d").'.log');
$apiLogManager->write("[API] request body\n" . json_encode($obj, JSON_PRETTY_PRINT), LogRecordType::INFO);
$apiLogManager->write("[API] POST body\n" . json_encode($_POST, JSON_PRETTY_PRINT), LogRecordType::INFO);

View File

@ -5,7 +5,7 @@ class GoogleHomeApi{
$json = file_get_contents('php://input');
$obj = json_decode($json, true);
$apiLogManager = new LogManager('../logs/api/HA/'. date("Y-m-d").'.log');
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log');
header('Content-Type: application/json');
switch ($obj['inputs'][0]['intent']) {
@ -30,7 +30,7 @@ class GoogleHomeApi{
$json = file_get_contents('php://input');
$obj = json_decode($json, true);
$apiLogManager = new LogManager('../logs/api/HA/'. date("Y-m-d").'.log');
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log');
$apiLogManager->write("[API] request body\n" . json_encode($obj, JSON_PRETTY_PRINT), LogRecordType::INFO);
$apiLogManager->write("[API] GET body\n" . json_encode($_GET, JSON_PRETTY_PRINT), LogRecordType::INFO);

View File

@ -40,7 +40,7 @@ class GoogleHome {
'devices' => $devices,
],
];
$apiLogManager = new LogManager('../logs/api/HA/'. date("Y-m-d").'.log');
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log');
$apiLogManager->write("[API][$requestId] request response\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordType::INFO);
echo json_encode($response);
}
@ -109,7 +109,7 @@ class GoogleHome {
],
];
$apiLogManager = new LogManager('../logs/api/HA/'. date("Y-m-d").'.log');
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log');
$apiLogManager->write("[API][$requestId] request response\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordType::INFO);
echo json_encode($response);
}
@ -148,7 +148,7 @@ class GoogleHome {
'commands' => $commands,
],
];
$apiLogManager = new LogManager('../logs/api/HA/'. date("Y-m-d").'.log');
$apiLogManager = new LogManager('../logs/google-home/'. date("Y-m-d").'.log');
$apiLogManager->write("[API][EXECUTE][$requestId]\n" . json_encode($response, JSON_PRETTY_PRINT), LogRecordType::INFO);
echo json_encode($response);