Start debug log
This commit is contained in:
@@ -2,6 +2,7 @@ import { connType } from '@core/slices/appSlice';
|
||||
import {
|
||||
addChannel,
|
||||
addChat,
|
||||
addLogEvent,
|
||||
addMessage,
|
||||
addNode,
|
||||
addPosition,
|
||||
@@ -86,6 +87,10 @@ export const cleanupListeners = (): void => {
|
||||
const registerListeners = (): void => {
|
||||
SettingsManager.debugMode = Protobuf.LogRecord_Level.TRACE;
|
||||
|
||||
connection.onLogEvent.subscribe((log) => {
|
||||
store.dispatch(addLogEvent(log));
|
||||
});
|
||||
|
||||
connection.onMeshPacket.subscribe((packet) => {
|
||||
store.dispatch(
|
||||
addRoute({
|
||||
|
||||
@@ -58,6 +58,7 @@ interface MeshtasticState {
|
||||
hostOverrideEnabled: boolean;
|
||||
hostOverride: string;
|
||||
chats: ChatEntries;
|
||||
logs: Types.LogEventPacket[];
|
||||
}
|
||||
|
||||
const initialState: MeshtasticState = {
|
||||
@@ -76,12 +77,16 @@ const initialState: MeshtasticState = {
|
||||
localStorage.getItem('hostOverrideEnabled') === 'true' ?? false,
|
||||
hostOverride: localStorage.getItem('hostOverride') ?? '',
|
||||
chats: {},
|
||||
logs: [],
|
||||
};
|
||||
|
||||
export const meshtasticSlice = createSlice({
|
||||
name: 'meshtastic',
|
||||
initialState,
|
||||
reducers: {
|
||||
addLogEvent: (state, action: PayloadAction<Types.LogEventPacket>) => {
|
||||
state.logs.push(action.payload);
|
||||
},
|
||||
setDeviceStatus: (state, action: PayloadAction<Types.DeviceStatusEnum>) => {
|
||||
state.deviceStatus = action.payload;
|
||||
},
|
||||
@@ -276,6 +281,7 @@ export const meshtasticSlice = createSlice({
|
||||
});
|
||||
|
||||
export const {
|
||||
addLogEvent,
|
||||
setDeviceStatus,
|
||||
setLastMeshInterraction,
|
||||
setReady,
|
||||
|
||||
Reference in New Issue
Block a user