cortex.cpp icon indicating copy to clipboard operation
cortex.cpp copied to clipboard

feat: Nitro structured log

Open hiro-v opened this issue 2 years ago • 3 comments

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

hiro-v avatar Jan 25 '24 11:01 hiro-v

@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
	}
}

CameronNg avatar Apr 04 '24 03:04 CameronNg

As far as i remember LOG_INFO and logging utils is not using json? for the schema part i think current version good enough

tikikun avatar Apr 04 '24 03:04 tikikun

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

tikikun avatar Apr 04 '24 06:04 tikikun

It's no longer relevant. Local logging is local logging. What should be prettified are telemetry logs.

louis-jan avatar Jul 05 '24 04:07 louis-jan