NAME
maclog - write to the macOS unified log from the command line
VERSION
version 0.0.5
USAGE
Simple version:
maclog --message 'Hello world!'
All the bells and whistles:
maclog --subsystem com.phoenixtrap.maclog \
--level info \
--category general \
--format "Hello %s number %i" \
--message 'world' \
--message 42
Arbitrary number of message strings without --message:
maclog --format "Hello %s number %i" -- world 42
DESCRIPTION
This script provides an easy way to add entries to the macOS unified log from the command line, a feat normally reserved for users of Apple's Swift and Objective-C APIs.
It is a thin wrapper around Log::Any::Adapter::MacOS::OSLog.
REQUIRED ARGUMENTS
--subsystem
The name of the subsystem field in the log entry in reverse DNS order. Defaults to com.phoenixtrap.maclog
.
--level
The desired logging level. As this command script is a thin wrapper around Log::Any::Adapter::MacOS::OSLog, it uses the following level names, mapped to corresponding macOS os_log(3) levels:
trace: os_log_debug(3)
debug: os_log_debug(3)
info: os_log_info(3)
notice: os_log_info(3)
warning: os_log_fault(3)
error: os_log_error(3)
critical: os_log(3)
alert: os_log(3)
emergency: os_log(3)
Defaults to info
.
--category
The desired category field in the unified log entry. Note that this is not related to Log::Any's notion of categories.
Defaults to general
.
OPTIONS
--private
Redacts the log message.
--format
A sprintf format describing where and how to format individual message values. If no --format is specified, message values will be joined together with spaces.
--message
Can be specified multiple times. Each --message value will be filled into the corresponding formatting code in the format. You may instead provide one or more message values at the end of the command preceded by --
.
--help
Prints helpful information about how to use this command script.
--man
Prints this command script's entire manual page.
DIAGNOSTICS
The entire point of this command script is diagnostics. Use the macOS log(1) command or the Console app to view the results.
EXIT STATUS
Exits 0 on success or viewing the help/manual page, 1 if there is a problem with the command line arguments. Other exit values may occur if there is a problem with code execution.
CONFIGURATION
None.
DEPENDENCIES
INCOMPATIBILITIES
Because this command script relies on the macOS unified logging system introduced in macOS Sierra version 10.12, it is incompatible with earlier versions of OS X, Mac OS X, the classic Mac OS, and all other non-Apple platforms (Microsoft Windows, Linux, other Unixes, etc.).
BUGS AND LIMITATIONS
Undoubtedly. Open an issue in the tracker.
SEE ALSO
The Eclectic Light Company's blowhole
command line utility, available at https://eclecticlight.co/consolation-t2m2-and-log-utilities/, performs a similar function but does not enable the user to change the subsystem or category.
SUPPORT
Perldoc
You can find documentation for this module with the perldoc command.
perldoc maclog
Websites
The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.
MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML format.
RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
https://rt.cpan.org/Public/Dist/Display.html?Name=Log-Any-Adapter-MacOS-OSLog
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
http://cpants.cpanauthors.org/dist/Log-Any-Adapter-MacOS-OSLog
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
http://www.cpantesters.org/distro/L/Log-Any-Adapter-MacOS-OSLog
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
http://matrix.cpantesters.org/?dist=Log-Any-Adapter-MacOS-OSLog
CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
http://deps.cpantesters.org/?module=Log::Any::Adapter::MacOS::OSLog
Bugs / Feature Requests
Please report any bugs or feature requests through the web interface at https://codeberg.org/mjgardner/perl-Log-Any-Adapter-MacOS-OSLog/issues.
Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)
https://codeberg.org/mjgardner/perl-Log-Any-Adapter-MacOS-OSLog
git clone https://codeberg.org/mjgardner/perl-Log-Any-Adapter-MacOS-OSLog.git
AUTHOR
Mark Gardner <mjgardner@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by Mark Gardner.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.