core: log unit failure with type-specific result code
This slightly changes how we log about failures. Previously, service_enter_dead() would log that a service unit failed along with its result code, and unit_notify() would do this again but without the result code. For other unit types only the latter would take effect. This cleans this up: we keep the message in unit_notify() only for debug purposes, and add type-specific log lines to all our unit types that can fail, and always place them before unit_notify() is invoked. Or in other words: the duplicate log message for service units is removed, and all other unit types get a more useful line with the precise result code.
This commit is contained in:
@@ -296,6 +296,9 @@ static void timer_enter_dead(Timer *t, TimerResult f) {
|
||||
if (t->result == TIMER_SUCCESS)
|
||||
t->result = f;
|
||||
|
||||
if (t->result != TIMER_SUCCESS)
|
||||
log_unit_warning(UNIT(t), "Failed with result '%s'.", timer_result_to_string(t->result));
|
||||
|
||||
timer_set_state(t, t->result != TIMER_SUCCESS ? TIMER_FAILED : TIMER_DEAD);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user