Open Console app to show Unified Logging logs - macos

My application uses os_log. When it's done with a task, I display a UserNotification. When the user clicks the notification, I want to display the logs created via through the Apple Unified System Logging.
If I were simply logging to a file, I would execute a Process(NSTask) with something like open /path/to/mylogs.log and this would open Console to show the logs. However, I'm using Unified System Logging through the os_log command. What Terminal command can I issue to open Console and have Console display my logs?

Related

Is there a way to disable IPVS message display from console prompt?

We installed k8s by kubespray and keep all settings by default parameter. Thus, the networking mode is ipvs. I noticed that there are some messages display on console prompt as below, sometimes it displays fast and annoying. The message is saved under kern.log already, so how can I stop it display on console prompt?
Message on console terminal

How can I add terminal console messages in mochawesome report

I am trying to automate accessibility testing using cypress-axe .I want to add the terminal console messages to my mochaweome report.

Trigger "application quit unexpectedly" popup when OS X deamon crashes

I'm working on a new OS-X Daemon process (run from launchd) and would like to get popup window every time it crashes with all relevant information (pid, path to crash file, etc...). This will sure help my debugging effort in this early stage of the development.
Basically, i want to have the same behavior as a UI application. For example :
I've made some research and found out about the CrashReporter, but i don't know how to register my app to this service. But it seem like there's no way to trigger popup windows from this service, since crashes are system level events and apps have zero interaction with those.
Maybe there's a way to do so by setting up some parameters in app bundle or via Info.plist ?
EDIT: looking at the crash report manual, it looks like the unexpected dialog works only on GUI user mode, and not on daemon that runs from launchd. perhaps i'm missing something ?
In addition, if the program that crashed is running as a logged in GUI user, CrashReporter will present the user with a dialog asking them whether they want to submit a bug report to Apple (see Figure 1). If the user clicks the Report button, CrashReporter displays another dialog that shows the details of the report (see Figure 2) and allows them to comment it before submission.
I've read that Developer option enable in addition to application crashes, crashes are also displayed for background and system processes. but unfortunately i doesn't work for me.
thanks
Seems like the problem occurs since my background process runs under root privilege, and root privilage process (not just daemons) cannot initiate any UI widget on the screen.
I guess that the only way to deal with it, is by catching the signal that trigger the crash, and send details for a proxy process that run on non-root mode and can initiate the UI dialog box with crash details.
I would be happy to hear for better proposals.
Since CrashReporterPrefs, which allowed you to enable this behavior for daemons, no longer comes with developer tools, you can change the behavior to show the dialog for daemons by running this command in the Terminal:
defaults write com.apple.CrashReporter DialogType Developer

How to write Electron debug messages into a file?

I am developing an Electron app and I want to write it's debug messages into a log file. If I start my app by executing electron electron --debug=5858, then the debug output shows up in my console.
I can grab the console output from the command-line by attaching > debug.log to my cmd statement but I wonder if there is also a programmatic way to save the debug logs for Electron's main process?
My main goal is to be able to write debug logs from the main process when distributing my app.

In ios how to programmatically detect when a system prompt is generated on a view?

Since system generates an alert for the first time to allow location services, I would like to detect when this ios prompt for location services is generated and not generate my customized prompt when ever system generates. (I would like to generate alert everytime a user is on a view. Trying to avoiding 2 alert views on top of one another).
iOS will only prompt once per app. After the user sets there permissions pref, the OS will not prompt again unless the device (or simulator) is reset. The OS will show the prompt if [CLLocationManager authorizationStatus] returns kCLAuthorizationStatusNotDetermined so, before you do anything with permission, you need to check the status first then you will know if you need to show your custom alert or not.

Resources