Skip to content

A command-line tool for sending log messages to Apple's unified logging system. 🪵

License

Notifications You must be signed in to change notification settings

marcransome/flog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flog

flog

Issues License macOS

flog is a command-line tool for sending log messages to Apple's unified logging system and is primaily intended for use in scripts.


Getting started

Installation

Install with Homebrew:

brew install marcransome/tap/flog

Logging messages

To log a message using the default log level:

flog '<message>'

Optionally specify a subsystem and category using the -s|--subsystem and -c|--category options:

flog -s uk.co.fidgetbox -c general 'informational message'

Override the default log level using the -l|--level option and one of the values info, debug, error or fault:

flog -l fault -s uk.co.fidgetbox -c general 'unrecoverable failure'

Warning: Log message strings are public by default and can be read using the log(1) command or Console app. To mark a message as private add the -p|--private option to the command. Doing so will redact the message string, which will be shown as '<private>' when accessed using the methods previously mentioned. Device Management Profiles can be used to grant access to private log messages.

Reading log messages

Refer to the log(1) man page provided on macOS-based systems for extensive documentation on how to access system wide log messages, or alternatively use the Console app.

Here's an example log stream in Console, filtered by subsystem name, showing messages generated by flog:

Console

And here's a similar log stream viewed with Apple's log(1) command:

log

Building

Requirements

  • macOS (11.x or later)
  • A C17 compiler
  • CMake (3.22 or later)

Building from source

To perform an out-of-source build from the project directory:

cmake -S . -B build
cmake --build build

Acknowledgements

License

flog is provided under the terms of the MIT License.

Contact

Email me at [email protected] or tweet @marcransome.

About

A command-line tool for sending log messages to Apple's unified logging system. 🪵

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project