macos-log-stream

command module
v0.0.0-...-194e68f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 6 Imported by: 0

README

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")'

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
mls

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL