modifs.mineures sans commentaires
This commit is contained in:
parent
58f561a4e2
commit
7e7069e23f
|
@ -228,16 +228,11 @@ abstract class Application {
|
||||||
|
|
||||||
static function set_application_log_output(string $logfile): void {
|
static function set_application_log_output(string $logfile): void {
|
||||||
msg::get()->setParametrableParams(["log_output" => $logfile]);
|
msg::get()->setParametrableParams(["log_output" => $logfile]);
|
||||||
if (!nlog::have_log()) {
|
nlog::create_or_reset_params([
|
||||||
nlog::set_messenger_class(nStdMessenger::class, [
|
"output" => $logfile,
|
||||||
"output" => $logfile,
|
], nStdMessenger::class, [
|
||||||
"add_date" => true,
|
"add_date" => true,
|
||||||
]);
|
]);
|
||||||
} else {
|
|
||||||
nlog::reset_params([
|
|
||||||
"output" => $logfile,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
static function set_application_color(bool $color): void {
|
static function set_application_color(bool $color): void {
|
||||||
msg::get()->setParametrableParams(["color" => $color]);
|
msg::get()->setParametrableParams(["color" => $color]);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
namespace nur\sery\output;
|
namespace nur\sery\output;
|
||||||
|
|
||||||
|
use nur\sery\cl;
|
||||||
use nur\sery\ValueException;
|
use nur\sery\ValueException;
|
||||||
use nur\sery\output\std\ProxyMessenger;
|
use nur\sery\output\std\ProxyMessenger;
|
||||||
|
|
||||||
|
@ -11,10 +12,6 @@ use nur\sery\output\std\ProxyMessenger;
|
||||||
* d'être utilisée
|
* d'être utilisée
|
||||||
*/
|
*/
|
||||||
class log extends _messenger {
|
class log extends _messenger {
|
||||||
static function have_log(): bool {
|
|
||||||
return self::$log !== null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static function set_messenger(IMessenger $log=null) {
|
static function set_messenger(IMessenger $log=null) {
|
||||||
self::$log = $log;
|
self::$log = $log;
|
||||||
// forcer la recréation de l'instance partagée $msg
|
// forcer la recréation de l'instance partagée $msg
|
||||||
|
@ -36,4 +33,17 @@ class log extends _messenger {
|
||||||
}
|
}
|
||||||
return self::$msg;
|
return self::$msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function have_log(): bool {
|
||||||
|
return self::$log !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function create_or_reset_params(?array $params=null, string $log_class=null, ?array $create_params=null) {
|
||||||
|
if (self::$log === null) {
|
||||||
|
$params = cl::merge($params, $create_params);
|
||||||
|
self::set_messenger_class($log_class, $params);
|
||||||
|
} else {
|
||||||
|
self::reset_params($params);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue