cortex.cpp
cortex.cpp copied to clipboard
feat: Nitro structured log
Problem
- It's hard to debug nitro problem
- The outer application needs a good way to parse nitro log in order to debug correctly
Success Criteria
-
Timestamp | LOG_TYPE | Content
Additional context
@tikikun @hiro-v Here is my structured logging proposal, please advise.
{
"timestamp": "2024-04-04T12:00:00Z",
"log_id": "123e4567-e89b-12d3-a456-426614174000",
"log_level": "INFO",
"message": "Nitro started"
}
{
"timestamp": "2024-04-04T12:00:00Z",
"log_id": "123e4567-e89b-12d3-a456-426614174001",
"log_level": "DEBUG",
"message": "Nitro stopped"
}
{
"timestamp": "2024-04-04T12:00:00Z",
"log_id": "123e4567-e89b-12d3-a456-426614174002",
"log_level": "WARN",
"message": "Could not find KV_CACHE directory",
"stack_trace": "Warning at llamaCPP::LoadModelImpl (controllers/llamaCPP.cc:574)"
}
{
"timestamp": "2024-04-04T12:00:00Z",
"log_id": "123e4567-e89b-12d3-a456-426614174003",
"log_level": "ERROR",
"message": "Error while generating response",
"error_code": 11,
"stack_trace": "Error at create_full_return_json (controllers/llamaCPP.cc:80)",
"ctx": {
"os": "Ubuntu 20.04",
"cpu": "Intel Core i3-12100F 4.30 GHz",
"memory": "16384MB RAM",
"gpu": "NVIDIA GeForce RTX 2070 Ventus 8GB",
"gpu_driver": "DCH 551.23"
}
}
{
"timestamp": "2024-04-04T12:00:00Z",
"log_id": "123e4567-e89b-12d3-a456-426614174004",
"log_level": "CRIT",
"message": "Missing GPU-Nvidia driver",
"error_code": 12,
"stack_trace": "Error at llamaCPP::InferenceImpl (controllers/llamaCPP.cc:186)",
"ctx": {
"os": "Ubuntu 20.04",
"cpu": "Intel Core i3-12100F 4.30 GHz",
"memory": "16384MB RAM",
"gpu": "NVIDIA GeForce RTX 2070 Ventus 8GB",
"gpu_driver": null
}
}
As far as i remember LOG_INFO and logging utils is not using json? for the schema part i think current version good enough
Currently timestamp and log_id and log level also supported by trantor, can you recheck? for example LOG_INFO -> will be logging for info and so on
It's no longer relevant. Local logging is local logging. What should be prettified are telemetry logs.