Clean up LogRecord

pull/8/head
Kevin Hester 2020-12-27 10:55:13 +08:00
rodzic 020ef9eea8
commit e7ab73e2a9
3 zmienionych plików z 75 dodań i 21 usunięć

Wyświetl plik

@ -6,9 +6,9 @@
- [mesh.proto](#mesh.proto) - [mesh.proto](#mesh.proto)
- [ChannelSettings](#.ChannelSettings) - [ChannelSettings](#.ChannelSettings)
- [Data](#.Data) - [Data](#.Data)
- [DebugString](#.DebugString)
- [DeviceState](#.DeviceState) - [DeviceState](#.DeviceState)
- [FromRadio](#.FromRadio) - [FromRadio](#.FromRadio)
- [LogRecord](#.LogRecord)
- [MeshPacket](#.MeshPacket) - [MeshPacket](#.MeshPacket)
- [MyNodeInfo](#.MyNodeInfo) - [MyNodeInfo](#.MyNodeInfo)
- [NodeInfo](#.NodeInfo) - [NodeInfo](#.NodeInfo)
@ -24,6 +24,7 @@
- [Constants](#.Constants) - [Constants](#.Constants)
- [GpsOperation](#.GpsOperation) - [GpsOperation](#.GpsOperation)
- [LocationSharing](#.LocationSharing) - [LocationSharing](#.LocationSharing)
- [LogRecord.Level](#.LogRecord.Level)
- [RegionCode](#.RegionCode) - [RegionCode](#.RegionCode)
- [RouteError](#.RouteError) - [RouteError](#.RouteError)
@ -120,21 +121,6 @@ internally in the case of CLEAR_TEXT and CLEAR_READACK)
<a name=".DebugString"></a>
### DebugString
Debug output from the device
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| message | [string](#string) | | |
<a name=".DeviceState"></a> <a name=".DeviceState"></a>
### DeviceState ### DeviceState
@ -182,7 +168,7 @@ FIFO will be populated.
| my_info | [MyNodeInfo](#MyNodeInfo) | | Tells the phone what our node number is, can be -1 if we&#39;ve not yet joined a mesh. | | my_info | [MyNodeInfo](#MyNodeInfo) | | Tells the phone what our node number is, can be -1 if we&#39;ve not yet joined a mesh. |
| node_info | [NodeInfo](#NodeInfo) | | One packet is sent for each node in the on radio DB starts over with the first node in our DB | | node_info | [NodeInfo](#NodeInfo) | | One packet is sent for each node in the on radio DB starts over with the first node in our DB |
| radio | [RadioConfig](#RadioConfig) | | In rev1 this was the radio BLE characteristic | | radio | [RadioConfig](#RadioConfig) | | In rev1 this was the radio BLE characteristic |
| debug_string | [DebugString](#DebugString) | | set to send debug console output over our protobuf stream | | log_record | [LogRecord](#LogRecord) | | set to send debug console output over our protobuf stream |
| config_complete_id | [uint32](#uint32) | | sent as true once the device has finished sending all of the responses to want_config recipient should check if this ID matches our original request nonce, if not, it means your config responses haven&#39;t started yet | | config_complete_id | [uint32](#uint32) | | sent as true once the device has finished sending all of the responses to want_config recipient should check if this ID matches our original request nonce, if not, it means your config responses haven&#39;t started yet |
| rebooted | [bool](#bool) | | Sent to tell clients the radio has just rebooted. Set to true if present. Not used on all transports, currently just used for the serial console. | | rebooted | [bool](#bool) | | Sent to tell clients the radio has just rebooted. Set to true if present. Not used on all transports, currently just used for the serial console. |
| secondary_channel | [ChannelSettings](#ChannelSettings) | | One of the secondary channels, they are all sent during config download | | secondary_channel | [ChannelSettings](#ChannelSettings) | | One of the secondary channels, they are all sent during config download |
@ -192,6 +178,29 @@ FIFO will be populated.
<a name=".LogRecord"></a>
### LogRecord
Debug output from the device.
To minimize the size of records inside the device code, if a time/source/level is not set
on the message it is assumed to be a contuinuation of the previously sent message. This allows
the device code to use fixed maxlen 64 byte strings for messages, and then extend as needed by
emitting multiple records.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| message | [string](#string) | | |
| time | [fixed32](#fixed32) | | Seconds since 1970 - or 0 for unknown/unset |
| source | [string](#string) | | Usually based on thread name - if known |
| level | [LogRecord.Level](#LogRecord.Level) | | Not yet set |
<a name=".MeshPacket"></a> <a name=".MeshPacket"></a>
### MeshPacket ### MeshPacket
@ -508,6 +517,23 @@ How our location is shared with other nodes (or the local phone)
<a name=".LogRecord.Level"></a>
### LogRecord.Level
Log levels, chosen to match python logging conventions.
| Name | Number | Description |
| ---- | ------ | ----------- |
| UNSET | 0 | |
| CRITICAL | 50 | |
| ERROR | 40 | |
| WARNING | 30 | |
| INFO | 20 | |
| DEBUG | 10 | |
| TRACE | 5 | |
<a name=".RegionCode"></a> <a name=".RegionCode"></a>
### RegionCode ### RegionCode

Wyświetl plik

@ -45,6 +45,9 @@
# Max of three ignored nodes for our testing # Max of three ignored nodes for our testing
*UserPreferences.ignore_incoming max_count:3 *UserPreferences.ignore_incoming max_count:3
*LogRecord.message max_size:64
*LogRecord.source max_size:8
# MyMessage.name max_size:40 # MyMessage.name max_size:40
# or fixed_length or fixed_count, or max_count # or fixed_length or fixed_count, or max_count

Wyświetl plik

@ -816,11 +816,36 @@ message DeviceState {
repeated ChannelSettings secondary_channels = 12; repeated ChannelSettings secondary_channels = 12;
} }
/// Debug output from the device /** Debug output from the device.
message DebugString {
To minimize the size of records inside the device code, if a time/source/level is not set
on the message it is assumed to be a contuinuation of the previously sent message. This allows
the device code to use fixed maxlen 64 byte strings for messages, and then extend as needed by
emitting multiple records.
*/
message LogRecord {
/** Log levels, chosen to match python logging conventions. */
enum Level {
UNSET = 0;
CRITICAL = 50;
ERROR = 40;
WARNING = 30;
INFO = 20;
DEBUG = 10;
TRACE = 5;
}
string message = 1; string message = 1;
// eventually we might add source and level /** Seconds since 1970 - or 0 for unknown/unset */
fixed32 time = 2;
/** Usually based on thread name - if known */
string source = 3;
/** Not yet set */
Level level = 4;
} }
// packets from the radio to the phone will appear on the fromRadio // packets from the radio to the phone will appear on the fromRadio
@ -848,7 +873,7 @@ message FromRadio {
RadioConfig radio = 6; RadioConfig radio = 6;
// set to send debug console output over our protobuf stream // set to send debug console output over our protobuf stream
DebugString debug_string = 7; LogRecord log_record = 7;
// sent as true once the device has finished sending all of the // sent as true once the device has finished sending all of the
// responses to want_config // responses to want_config