Skip to content

Go wrapper around the streaming part of the unified logging system on MacOS.

License

Notifications You must be signed in to change notification settings

MaxSchaefer/macos-log-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

macos-log-stream

Go wrapper around the > log stream command of the unified logging system on MacOS.

pkg/mls

This example shows the main purpose of the package. If you start gathering logs, the mls package runs log stream --color none --style ndjson. When logs.Predicate is set, the mls package appends ... --predicate [logs.Predicate] to the command.

package main

import (
	"fmt"
	"github.com/MaxSchaefer/macos-log-stream/pkg/mls"
)

func main() {
	logs := mls.NewLogs()

	// logs.Predicate = ""

	if err := logs.StartGathering(); err != nil {
		panic(err)
	}

	for log := range logs.Channel {
		fmt.Println(log.EventMessage)
	}
}

cli

To build the cli run make build.

# Show logs when the webcam turns on or off
mls -predicate 'subsystem == "com.apple.UVCFamily" && (eventMessage CONTAINS[c] "start stream" || eventMessage CONTAINS[c] "stop stream")'

About

Go wrapper around the streaming part of the unified logging system on MacOS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published