Skip to content

Commit

Permalink
fix: error using the backend logger to add an UI log due to accessing…
Browse files Browse the repository at this point in the history
… to logger undefined property
  • Loading branch information
Desvelao committed Jan 31, 2025
1 parent 29dccb2 commit 7ad65ba
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class UiLogsCtrl {
try {
const { location, message, level } = request.body;
const loggerUI = context.wazuh.logger.get('ui');
const loggerByLevel = loggerUI?.[level] || loggerUI.error;
loggerByLevel(`${location}: ${message}`);
const loggerLevel = loggerUI?.[level] ? level : 'error';
loggerUI[loggerLevel](`${location}: ${message}`);
return response.ok({
body: {
statusCode: 200,
Expand Down

0 comments on commit 7ad65ba

Please sign in to comment.