Skip to content
/ ul Public

Provides macOS Sierra/OSX Unified Loggging functionality via cgo

License

Notifications You must be signed in to change notification settings

aletheia7/ul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Reference

Install

go get github.com/aletheia7/ul
go test -v
  • Requires OSX Xcode compiler
  • Supports macOS os_log subsystem/category logging
  • Implements io.Writer and can be used with the go log package

Example

package main

import (
	"github.com/aletheia7/ul"
	"log"
)

func main() {
	l := ul.New()
	l.Log("Hello")

	// To see subsystem/category messages:
	// # log stream --level debug --predicate 'subsystem == "com.example.myapp"'
	// Filtering the log data using "subsystem == "com.example.myapp""
	// Timestamp                       Thread     Type        Activity             PID
	// 2017-09-07 17:17:01.680996-0700 0x20870    Default     0x0                  1842   t: [com.example.myapp.whatever] hi

	lo := ul.New_object("com.example.myapp", "whatever")
	// Must call Release() for subsystem/category logger only
	defer lo.Release()
	lo.Log("hi")
	
	// golang log package

	mylogger := log.New(lo, "stuff ", log.Lshortfile|log.Ltime)
	mylogger.Println("wow") 
}

License

Use of this source code is governed by a BSD-2-Clause license that can be found in the LICENSE file.

BSD-2-Clause License

About

Provides macOS Sierra/OSX Unified Loggging functionality via cgo

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages