Amethyst
Amethyst copied to clipboard
Question about accessing logs
Describe the bug
I'm trying to build a custom layout and I'd like to print out some debug info as I build the layout. The problem is: I have no idea how to access the logs.
Here is everything I tried:
-
Looked in the MacOS Console app I had never used before, but I managed to filter out the Amethyst process. Still it wouldn't output anything related to custom layouts.
-
Checked the
Show debug info
option I had never used before, but I managed to filter out the Amethyst process. Still it wouldn't output anything related to custom layouts. -
Run the app with the
--log
option I found this option in the code, but couldn't make it work, I always get an error.$ /Applications/Amethyst.app/Contents/MacOS/Amethyst --log Error: Unknown option '--log' Usage: amethyst app See 'amethyst app --help' for more information.
I also tried
/Applications/Amethyst.app/Contents/MacOS/Amethyst app --log
, same error -
Look through past PRs, Issues, and the codebase I spent a good hour trying to dig through issues, PRs and the codebase itself. I did find useful information there, namely the fact that logs should be accessible somewhere, the
--log
option. But considering I've never developed any swift app, it quickly got overwhelming and I couldn't really figure out how to access these logs or where they're written to
In the end, I did manage to access the logs, but only by building the app myself, and running if from X-Code. There I could finally see my JS debug output.
My question is
- How can I access the logs without having to build it myself in X-Code?
- How can I pass this
--log
option?
Closing notes
Just wanted to add a quick note to thank you for your work. I only recently discovered Amethyst, and it's a dream come true, especially with these custom layouts 😃
Fantastic work 💯🎉
Applications: Amethyst
To Reproduce Try to access the logs
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Versions:
- macOS: 13.4.1
- Amethyst: 0.20.0 (108)
Debug Info
Version: 0.20.0 (108)
OS version: Version 13.4.1 (c) (Build 22F770820d)
Screens:
(0.0, 0.0, 1680.0, 1050.0) [(0.0, 0.0, 1680.0, 1050.0)]
(-1211.0, 1050.0, 5120.0, 1440.0) [(-1211.0, -1440.0, 5120.0, 1440.0)]
Configuration:
new-windows-to-main: 0
window-margin-size: 30
mouse-follows-focus: 0
screen-padding-bottom: 0
enables-layout-hud: 1
mod2: (
option,
shift,
control
)
follow-space-thrown-windows: 1
window-minimum-height: 0
focus-follows-mouse: 0
use-canary-build: 0
enables-layout-hud-on-space-change: 1
smart-window-margins: 0
window-max-count: 0
layouts: (
"the-main-layout",
"middle-wide",
tall,
fullscreen
)
screen-padding-left: 0
mod1: (
option,
shift
)
window-margins: 1
floating-is-blacklist: 1
floating: (
{
id = "com.lencx.chatgpt";
"window-titles" = (
);
}
)
window-resize-step: 5
float-small-windows: 1
mouse-resizes-windows: 0
debug-layout-info: 1
screen-padding-top: 0
mouse-swaps-windows: 1
window-minimum-width: 0
screen-padding-right: 0
ignore-menu-bar: 0
restore-layouts-on-launch: 1
Manageable applications:
Vivaldi (com.vivaldi.Vivaldi)
ChatGPT (com.lencx.chatgpt)
iTerm2 (com.googlecode.iterm2)
Fantastical (com.flexibits.fantastical2.mac)
Finder (com.apple.finder)
Spotify (com.spotify.client)
Notes (com.apple.Notes)
Google Chrome (com.google.Chrome)
OmniFocus (com.omnigroup.OmniFocus3.MacAppStore)
Discord (com.hnc.Discord)
Timery (com.joehribar.toggl)
Notion (notion.id)
Note: --include-apps
will list your manageable applications, but is optional if you don't want to list that.
Additional context Add any other context about the problem here.
I struggled with the same problem, and I found that the default argument parser does not include the --log
option. Even though it is checked here
https://github.com/ianyh/Amethyst/blob/e6f7a5d63e8829dae6d88ed4a4c3dc5c60158672/Amethyst/AppDelegate.swift#L39-L43
However, after reading more code, I found that passing test
as the first argument kinda bypasses the whole argument parsing.
https://github.com/ianyh/Amethyst/blob/e6f7a5d63e8829dae6d88ed4a4c3dc5c60158672/Amethyst/main.swift#L33-L34
So, I can enable logging by executing the release build with test --log
arguments, and after that, I see all log messages in the terminal.
@Henkru that's a good catch, and easy enough to fix. Thanks for looking into it.
Oh wow @Henkru, great job! 💯 I tried to follow the path of arguments like you did, but got lost in the unknown waters of Swift code 😁 Thanks for picking up where I left off 👍
@ianyh Thanks for following up. As I said before, that's a fantastic app you built there 🎉
I can confirm I can access the logs with ./Amethyst test --log
, I'll do that until a fix is pushed. This greatly simplifies my workflow!
Is there any way to access the Javascript logs for custom layouts? I tried with ./Amethyst test --log
but console.log
from the Javascript layout doesn't end up there.