Comparison

core/moduleapi.lua @ 12874:b9468c8ac1d3

core.moduleapi: Fix passing variable to logging
author Kim Alvefur <zash@zash.se>
date Tue, 31 Jan 2023 07:48:21 +0100
parent 12690:546c7e0f3f31
child 12921:d238633a9d67
comparison
equal deleted inserted replaced
12873:7f4f834fae79 12874:b9468c8ac1d3
578 local status_priorities = { error = 3, warn = 2, info = 1, core = 0 }; 578 local status_priorities = { error = 3, warn = 2, info = 1, core = 0 };
579 579
580 function api:set_status(status_type, status_message, override) 580 function api:set_status(status_type, status_message, override)
581 local priority = status_priorities[status_type]; 581 local priority = status_priorities[status_type];
582 if not priority then 582 if not priority then
583 self:log("error", "set_status: Invalid status type '%s', assuming 'info'"); 583 self:log("error", "set_status: Invalid status type '%s', assuming 'info'", status_type);
584 status_type, priority = "info", status_priorities.info; 584 status_type, priority = "info", status_priorities.info;
585 end 585 end
586 local current_priority = status_priorities[self.status_type] or 0; 586 local current_priority = status_priorities[self.status_type] or 0;
587 -- By default an 'error' status can only be overwritten by another 'error' status 587 -- By default an 'error' status can only be overwritten by another 'error' status
588 if (current_priority >= status_priorities.error and priority < current_priority and override ~= true) 588 if (current_priority >= status_priorities.error and priority < current_priority and override ~= true)