mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-20 18:32:09 +00:00
stream alarm info to console
This commit is contained in:
parent
25bd79af54
commit
1cd0f6c5f9
2 changed files with 52 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
|||
2019-05-28 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* EcControl.m: Stream alarm information to Console for Wolfgang.
|
||||
|
||||
2019-05-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* EcUserDefaults.h:
|
||||
|
|
53
EcControl.m
53
EcControl.m
|
@ -399,12 +399,55 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
|
||||
- (oneway void) alarm: (in bycopy EcAlarm*)alarm
|
||||
{
|
||||
EcAlarmSeverity severity;
|
||||
EcAlarmSeverity severity = [alarm perceivedSeverity];
|
||||
NSString *desc = [alarm description];
|
||||
|
||||
if (EcAlarmSeverityCleared != severity
|
||||
&& EcAlarmSeverityIndeterminate != severity)
|
||||
{
|
||||
NSArray *a = [NSArray arrayWithArray: consoles];
|
||||
NSUInteger i = [a count];
|
||||
|
||||
/*
|
||||
* Work with a copy of the consoles array in case one goes away
|
||||
* or is added while we are doing this!
|
||||
*/
|
||||
while (i-- > 0)
|
||||
{
|
||||
ConsoleInfo *c = [a objectAtIndex: i];
|
||||
|
||||
if ([consoles indexOfObjectIdenticalTo: c] == NSNotFound)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (EcAlarmSeverityWarning == severity && [c getWarnings] == NO)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((EcAlarmSeverityMajor == severity
|
||||
|| EcAlarmSeverityMinor == severity) && [c getErrors] == NO)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (EcAlarmSeverityCritical == severity && [c getAlerts] == NO)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
[[c obj] information: [c promptAfter: desc]];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Caught: %@", localException);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
|
||||
[[self cmdLogFile: logname] puts: desc];
|
||||
|
||||
/* Now, for critical and major alarms, generate a corresponding old style
|
||||
* alert.
|
||||
*/
|
||||
severity = [alarm perceivedSeverity];
|
||||
if (EcAlarmSeverityCleared == severity)
|
||||
{
|
||||
NSArray *a = [sink alarms];
|
||||
|
|
Loading…
Reference in a new issue