diff --git a/docs/docs.md b/docs/docs.md
index cc03cbf..51571fd 100644
--- a/docs/docs.md
+++ b/docs/docs.md
@@ -6,9 +6,9 @@
- [mesh.proto](#mesh.proto)
- [ChannelSettings](#.ChannelSettings)
- [Data](#.Data)
- - [DebugString](#.DebugString)
- [DeviceState](#.DeviceState)
- [FromRadio](#.FromRadio)
+ - [LogRecord](#.LogRecord)
- [MeshPacket](#.MeshPacket)
- [MyNodeInfo](#.MyNodeInfo)
- [NodeInfo](#.NodeInfo)
@@ -24,6 +24,7 @@
- [Constants](#.Constants)
- [GpsOperation](#.GpsOperation)
- [LocationSharing](#.LocationSharing)
+ - [LogRecord.Level](#.LogRecord.Level)
- [RegionCode](#.RegionCode)
- [RouteError](#.RouteError)
@@ -120,21 +121,6 @@ internally in the case of CLEAR_TEXT and CLEAR_READACK)
-
-
-### DebugString
-Debug output from the device
-
-
-| Field | Type | Label | Description |
-| ----- | ---- | ----- | ----------- |
-| message | [string](#string) | | |
-
-
-
-
-
-
### 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'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 |
| 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'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. |
| secondary_channel | [ChannelSettings](#ChannelSettings) | | One of the secondary channels, they are all sent during config download |
@@ -192,6 +178,29 @@ FIFO will be populated.
+
+
+### 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 |
+
+
+
+
+
+
### MeshPacket
@@ -508,6 +517,23 @@ How our location is shared with other nodes (or the local phone)
+
+
+### 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 | |
+
+
+
### RegionCode
diff --git a/mesh.options b/mesh.options
index 3c09977..2492e18 100644
--- a/mesh.options
+++ b/mesh.options
@@ -45,6 +45,9 @@
# Max of three ignored nodes for our testing
*UserPreferences.ignore_incoming max_count:3
+*LogRecord.message max_size:64
+*LogRecord.source max_size:8
+
# MyMessage.name max_size:40
# or fixed_length or fixed_count, or max_count
diff --git a/mesh.proto b/mesh.proto
index f1fef18..64832dc 100644
--- a/mesh.proto
+++ b/mesh.proto
@@ -816,11 +816,36 @@ message DeviceState {
repeated ChannelSettings secondary_channels = 12;
}
-/// Debug output from the device
-message DebugString {
+/** 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.
+*/
+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;
- // 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
@@ -848,7 +873,7 @@ message FromRadio {
RadioConfig radio = 6;
// 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
// responses to want_config