[mod] logging
This commit is contained in:
parent
43c1cda101
commit
834953b635
|
|
@ -41,7 +41,17 @@ namespace _zeitbild.conf
|
|||
"error"
|
||||
],
|
||||
"default": "info"
|
||||
}
|
||||
},
|
||||
"format": {
|
||||
"nullable": false,
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"human_readable",
|
||||
"jsonl",
|
||||
"jsonl_structured",
|
||||
],
|
||||
"default": "human_readable",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
]
|
||||
|
|
|
|||
|
|
@ -165,11 +165,17 @@ async function main(
|
|||
) : Promise<void>
|
||||
{
|
||||
// init1
|
||||
lib_plankton.log.conf_push(
|
||||
/*
|
||||
lib_plankton.log.set_main_logger(
|
||||
[
|
||||
lib_plankton.log.channel_make({"kind": "stdout", "data": {"threshold": "info"}}),
|
||||
{
|
||||
"kind": "std",
|
||||
"data": {
|
||||
}
|
||||
}
|
||||
]
|
||||
);
|
||||
*/
|
||||
|
||||
// args
|
||||
const arg_handler : lib_plankton.args.class_handler = new lib_plankton.args.class_handler({
|
||||
|
|
@ -258,12 +264,54 @@ async function main(
|
|||
await _zeitbild.conf.init(
|
||||
args["conf_path"]
|
||||
);
|
||||
lib_plankton.log.conf_push(
|
||||
lib_plankton.log.set_main_logger(
|
||||
_zeitbild.conf.get().log.map(
|
||||
(log_output : any) => lib_plankton.log.channel_make(
|
||||
{
|
||||
"kind": log_output.kind,
|
||||
"data": log_output.data
|
||||
(log_output : any) => {
|
||||
switch (log_output.kind) {
|
||||
case "stdout": {
|
||||
return {
|
||||
"kind": "minlevel",
|
||||
"data": {
|
||||
"core": {
|
||||
"kind": "std",
|
||||
"data": {
|
||||
"target": "stdout",
|
||||
"format": lib_plankton.call.distinguish(
|
||||
{
|
||||
"kind": log_output.data.format,
|
||||
"data": null,
|
||||
},
|
||||
{
|
||||
"jsonl": () => ({
|
||||
"kind": "jsonl",
|
||||
"data": {
|
||||
"structured": false,
|
||||
}
|
||||
}),
|
||||
"jsonl_structured": () => ({
|
||||
"kind": "jsonl",
|
||||
"data": {
|
||||
"structured": true,
|
||||
}
|
||||
}),
|
||||
"human_readable": () => ({
|
||||
"kind": "human_readable",
|
||||
"data": {
|
||||
}
|
||||
}),
|
||||
}
|
||||
),
|
||||
}
|
||||
},
|
||||
"threshold": log_output.data.threshold,
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
throw (new Error("unhandled"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
|
@ -327,7 +375,7 @@ async function main(
|
|||
break;
|
||||
}
|
||||
case "api-doc": {
|
||||
lib_plankton.log.conf_push([]);
|
||||
lib_plankton.log.set_main_logger([]);
|
||||
const rest_subject : lib_plankton.rest.type_rest = _zeitbild.api.make();
|
||||
lib_plankton.log.conf_pop();
|
||||
process.stdout.write(
|
||||
|
|
|
|||
Loading…
Reference in a new issue