mirror of
https://github.com/dpup/meshstream.git
synced 2026-08-07 01:03:10 +02:00
Add Logista for JSON log processing
- Add .logista.yaml configuration for prettier log output - Add github.com/dpup/logista as a go tool - Update Makefile run target to pipe output through logista - Configure the format to show timestamp, level, and message with colors - Add special formatting for different message types - Display telemetry and position data in readable format - Add table display for remaining structured fields
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# Meshstream Logista Configuration
|
||||
format: |
|
||||
{{ $timestamp := .timestamp | date | color "blue" }}
|
||||
{{ $level := .level | colorByLevel .level | bold }}
|
||||
{{ $logger := .logger | dim }}
|
||||
{{ $message := .msg }}
|
||||
|
||||
{{ $timestamp }} {{ $level }} [{{ $logger }}] {{ $message }}
|
||||
|
||||
{{- if .from }}
|
||||
{{ "From:" | dim }} {{ .from }} {{ "To:" | dim }} {{ .to -}}
|
||||
{{- if .portNum }} {{ "Type:" | dim }} {{ .portNum | color "magenta" }}{{ end -}}
|
||||
{{- if .channel }} {{ "Channel:" | dim }} {{ .channel | color "green" }}{{ end -}}
|
||||
{{- if .gateway }} {{ "Gateway:" | dim }} {{ .gateway | color "yellow" }}{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if eq .level "error" }}
|
||||
{{ if .error }}{{ .error | color "red" }}{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .message }}
|
||||
{{ "Message:" | dim }} {{ .message }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and .latitude .longitude }}
|
||||
{{ "Position:" | dim }} {{ .latitude }}, {{ .longitude }}{{ if .altitude }} Alt: {{ .altitude }}m{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if or .temperature .batteryLevel .voltage }}
|
||||
{{ "Telemetry:" | dim }}{{ if .temperature }} Temp: {{ .temperature }}°C{{ end }}{{ if .batteryLevel }} Battery: {{ .batteryLevel }}%{{ end }}{{ if .voltage }} Voltage: {{ .voltage }}V{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{ filter . "timestamp" "level" "logger" "msg" "error" "from" "to" "portNum" "channel" "gateway" "message" "latitude" "longitude" "altitude" "temperature" "batteryLevel" "voltage" | table }}
|
||||
|
||||
# Date formatting
|
||||
date_format: "15:04:05.000"
|
||||
|
||||
# Handle non-JSON lines
|
||||
handle_non_json: true
|
||||
@@ -12,9 +12,9 @@ build:
|
||||
mkdir -p dist
|
||||
go build -o dist/meshstream
|
||||
|
||||
# Run the application
|
||||
# Run the application with json log formatting
|
||||
run: build
|
||||
./dist/meshstream
|
||||
./dist/meshstream 2>&1 | go tool github.com/dpup/logista
|
||||
|
||||
# Generate Go code from Protocol Buffers
|
||||
gen-proto: tools
|
||||
|
||||
Reference in New Issue
Block a user