Skip to content

Utilities Logging

Thomas Trutt edited this page Apr 14, 2025 · 1 revision

logging

Production

Logging in production is more limited and is set to the WARNING level. This means that only WARNING and ERROR messages will be logged. This is done to reduce the amount of log data generated in production. by default the main.py function does not add any custom log format. This is to support AWS Lamdba logging functions.

If you wish to have more detailed logging for development it is suggested that you use the dev.py script.

Development

logdy is a tool to help with logging. It can be used to view logs in a more readable format. It can be installed using the following command:

python ./dev.py | logdy

This will start the dev.py script and pipe the output to logdy. This will allow you to view the logs in a more readable format.

Logs can be viewed via the web interface at http://localhost:8000.

This will start a web server on port 8000 and the dev script will pause for 20 seconds before it starts to execute the main procedures.

A custom format can be used to view the logs in a more readable format. This will split the log data into Level, Date - time, Module and Message. It will also add the Level and Module to the quick filters section.

{
	"name": "main",
	"columns": [
		{
			"id": "308348",
			"name": "Level",
			"handlerTsCode": "(line: Message): CellHandler => {\n    tmp = line.content.split('|')\n    return { text: tmp[0] }\n}",
			"faceted": true,
			"idx": 1,
			"width": 179
		},
		{
			"id": "155697",
			"name": "Date - time",
			"handlerTsCode": "(line: Message): CellHandler => {\n    tmp = line.content.split('|')\n    return { text: tmp[1] }\n}",
			"faceted": false,
			"idx": 2,
			"width": 246
		},
		{
			"id": "203256",
			"name": "Module",
			"handlerTsCode": "(line: Message): CellHandler => {\n    tmp = line.content.split('|')\n    return { text: tmp[2] }\n}",
			"faceted": true,
			"idx": 3,
			"width": 277
		},
		{
			"id": "506975",
			"name": "Message",
			"handlerTsCode": "(line: Message): CellHandler => {\n    tmp = line.content.split('|')\n    return { text: tmp[3] }\n}",
			"faceted": false,
			"idx": 4,
			"width": 510
		},
		{
			"id": "292669",
			"name": "raw",
			"handlerTsCode": "(line: Message): CellHandler => {\n    return { text: line.content || \"-\" }\n}",
			"idx": 0,
			"width": 150,
			"hidden": true
		}
	],
	"settings": {
		"leftColWidth": 300,
		"drawerColWidth": 1075,
		"maxMessages": 1000,
		"middlewares": [],
		"entriesOrder": "desc"
	}
}

Clone this wiki locally