logging_on_oslog 1.0.0 logging_on_oslog: ^1.0.0 copied to clipboard
Log using os_log on iOS or macOS so that you can check the logs using Console.app on a macOS machine.
Log using os_log on iOS or macOS so that you can check the logs using Console.app on a macOS machine.
iOS/macOS only #
This plugins works only on iOS and macOS. It is suggested to verify the platform you are on before using this plugin:
import 'dart:io';
// ...
if (Platform.isIOS || Platform.isMacOS) {
// Use this plugin.
}
Warning about your user's privacy #
All logs are public. Anyone with access to the device will be able to access the logs using Console.app. If this plugin is used in production, it is important that you filter the messages for private information before logging them.
Getting Started #
If on macOS, make sure you target version 10.13 or greater.
Import the needed dependencies:
import 'package:logging_on_oslog/logging_on_oslog.dart';
import 'package:logging/logging.dart';
Subscribe to any Logger
, for instance the root
one. Make
sure that you are on iOS or macOS:
if (Platform.isIOS || Platform.isMacOS) {
_logOnOSLogSubscription = Logger.root.activateOsLog();
}
Log a message and see it in the Console.app:
Logger.root.info('info! Value: $_counter');