23 lines
496 B
PHP
Executable File
23 lines
496 B
PHP
Executable File
#!/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); |