Event¶
Description¶
The Event object represents a system or runtime event which is sent to certain EventOutput objects whenever it is triggered.
› Inherits: | DataObject |
---|
Properties¶
category¶
This property is optional and can be set to group events. This property can be used for filtering within EventOutput. If no category is set and the event is child of an EventGroup the category of the group is used.
› Type: | EventCategory |
---|---|
› Signal: | categoryChanged() |
› Attributes: | Writable, Optional |
errorCode¶
This property holds a user-defined, system- or application-specific error code and can be used for data modelling purposes. Its value is not evaluated by any InCore object.
› Type: | SignedInteger |
---|---|
› Default: | 0 |
› Signal: | errorCodeChanged() |
› Attributes: | Writable, Optional |
severity¶
This property holds the severity of this event. If the event is child of an EventGroup and the severity property of the event equals Event.NoSeverity the severity of the event group is used instead.
› Type: | Severity |
---|---|
› Default: | Event.NoSeverity |
› Signal: | severityChanged() |
› Attributes: | Writable, Optional |
Methods¶
trigger()¶
This method triggers the event. If the event belongs to an EventLog with one or multiple attached EventOutput objects it will be forwarded to these outputs. Depending on the configured filters it either will be discarded or handled by the respective output.
Enumerations¶
Severity¶
This enumeration describes all possible types of data which can be represented by the DataObject.data property.
Name | Value | Description |
---|---|---|
Event.NoSeverity |
0 |
The event has no dedicated severity and will match any severity filters. |
Event.Debug |
1 |
The event is only relevant for debugging the application. |
Event.Information |
2 |
Events of this severity are used for informational purposes, e.g. information on the current operating status. |
Event.Warning |
3 |
Events of this severity signal deviations from the normal operating state. |
Event.Error |
4 |
An error occurred and usually requires actions to be taken. |
Event.Fatal |
5 |
A fatal error occurred which usually leads to a system failure. |
Example¶
import InCore.Foundation 2.5
Application {
Timer {
interval: 5000
onTriggered: timerEvent.trigger()
}
EventLog {
//define categories to group events - its id can be handled in the outputs
EventCategory {
id: deviceCategory
}
//each Event in the group will get the groups category and severity, besides it overrides them
EventGroup {
category: deviceCategory
severity: Event.Error
Event {
id: omniscientEvent
errorCode: 42
name: "omniscient event"
description: "the answer to life, the universe and everything"
severity: Event.Information
}
Event {
id: timerEvent
name: "Timer event"
description: "the timer timed out"
}
}
//each event will be delivered to all outputs, but only handled if the filtering based on category or severity matches
outputs: [ journal ]
}
//this outputs date, time, name and description of the event to the journal if the category matches
EventJournal {
id: journal
}
}