journalisation en erreur
This commit is contained in:
23
servers/linux/monitoring/bin/log-cli.php
Executable file
23
servers/linux/monitoring/bin/log-cli.php
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/**
|
||||
* Pont de logging pour scripts Bash
|
||||
*/
|
||||
require_once __DIR__ . '/../lib/monitoring-lib.php';
|
||||
|
||||
if ($argc < 4) {
|
||||
fwrite(STDERR, "Usage: log-cli.php <LEVEL> <EVENT> <MESSAGE> [CONTEXT...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$level = strtoupper($argv[1]);
|
||||
$event = $argv[2];
|
||||
$message = $argv[3];
|
||||
$context = [];
|
||||
|
||||
// On récupère les arguments restants comme contexte
|
||||
for ($i = 4; $i < $argc; $i++) {
|
||||
$context[] = $argv[$i];
|
||||
}
|
||||
|
||||
log_event($level, $event, $message, $context);
|
||||
Reference in New Issue
Block a user