Open djak250 opened 3 months ago
The recent changes enhance the logging functionality in the recognize.controller.js
file. By replacing direct logging of objects with a formatted JSON string, the output becomes significantly clearer and easier to read. This adjustment retains the method's original logic while improving the debugging experience, particularly for nested structures.
Files | Change Summary |
---|---|
api/src/controllers/recognize.controller.js |
Improved logging in the start method by using JSON.stringify for better readability of nested structures. |
🐰 In the code where rabbits roam,
A log now shines, a clearer home.
JSON strings, so neat and bright,
Help us see the data's light.
Hooray for changes, let them be,
Debugging joy for you and me! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
At present, the logs are lacking some important information for events due to JS not deeply printing the object. Ex:
info: {
id: 'c28a...17',
duration: 0.18,
timestamp: '2024-08-05T18:20:08.803Z',
attempts: 1,
camera: 'manual',
zones: [],
counts: { person: 1, match: 0, miss: 0, unknown: 1 },
matches: [],
misses: [],
unknowns: [
{
name: 'unknown',
confidence: 0,
match: false,
box: [Object], /// Here
checks: [Array], /// and Here
type: 'manual',
duration: 0.15,
detector: 'aiserver',
filename: '66c6..3b10.jpg'
}
]
}
Logs after this change
info: {
"id": "1722...du",
"duration": 17.15,
"timestamp": "2024-08-05T19:07:21.418Z",
"attempts": 18,
"camera": "south",
"zones": [
"garage"
],
"counts": {
"person": 0,
"match": 0,
"miss": 0,
"unknown": 0
},
"matches": [],
"misses": [],
"unknowns": [
{
"name": "unknown",
"confidence": 0,
"match": false,
"box": { /// Helpful information
"top": 63,
"left": 180,
"width": 36,
"height": 54
},
"checks": [
"confidence too low: 0 < 40" /// Now I know why it didn't match
],
"type": "snapshot",
"duration": 0.13,
"detector": "aiserver",
"filename": "953e...fb00.jpg"
}
]
}
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.
@skrashevich Any thoughts about merging this?
@skrashevich Any thoughts about merging this?
Please, rebase to beta branch
JSON.stringify the loggedOutput object to keep helpful information like
box
andchecks
in the logsSummary by CodeRabbit