Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.29 KB

README.md

File metadata and controls

50 lines (37 loc) · 1.29 KB

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