An open API service indexing awesome lists of open source software.

https://github.com/aletheia7/ul

Provides macOS Sierra/OSX Unified Loggging functionality via cgo
https://github.com/aletheia7/ul

golang logging macos osx sierra unified xcode

Last synced: 4 months ago
JSON representation

Provides macOS Sierra/OSX Unified Loggging functionality via cgo

Awesome Lists containing this project

README

        

[![Go Reference](https://pkg.go.dev/badge/github.com/aletheia7/ul.svg)](https://pkg.go.dev/github.com/aletheia7/ul)

#### Install
```bash
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

```go
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](img/osi_logo_100X133_90ppi_0.png)](https://opensource.org/)