Verified Commit 96cb8fe1 authored by Damien's avatar Damien

FEAT #13439 TIME 0:40 Log for localeo script

parent 8837f0d8
......@@ -542,5 +542,29 @@ class LocaleoScript
$file = fopen('bin/external/localeo/localeoScript.log', 'a');
fwrite($file, '[' . date('Y-m-d H:i:s') . '] ' . $args['message'] . PHP_EOL);
fclose($file);
if (strpos($args['message'], '[ERROR]') === 0) {
\SrcCore\controllers\LogsController::add([
'isTech' => true,
'moduleId' => 'localeo',
'level' => 'ERROR',
'tableName' => '',
'recordId' => 'Localeo',
'eventType' => 'Localeo',
'eventId' => $args['message']
]);
} else {
\SrcCore\controllers\LogsController::add([
'isTech' => true,
'moduleId' => 'localeo',
'level' => 'INFO',
'tableName' => '',
'recordId' => 'Localeo',
'eventType' => 'Localeo',
'eventId' => $args['message']
]);
}
\History\models\BatchHistoryModel::create(['info' => $args['message'], 'module_name' => 'localeo']);
}
}
......@@ -37,4 +37,24 @@ abstract class BatchHistoryModelAbstract
return $history;
}
public static function create(array $args)
{
ValidatorModel::notEmpty($args, ['info', 'module_name']);
ValidatorModel::stringType($args, ['info', 'module_name']);
DatabaseModel::insert([
'table' => 'history_batch',
'columnsValues' => [
'module_name' => $args['module_name'],
'batch_id' => $args['batch_id'] ?? null,
'event_date' => 'CURRENT_TIMESTAMP',
'info' => $args['info'],
'total_processed' => $args['total_processed'] ?? 0,
'total_errors' => $args['total_processed'] ?? 0,
]
]);
return true;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment