What is a reliable way for me to get rid of these types of logs at the beginning of starting my application? It isn't important but it is kind of annoying.
PS G:\Programming\Clojure\Apr_2025\brainfloj\brainfloj> clojure -M:flow -m floj.cli
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\neurosdk-x64.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\Unicorn.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\gForceSDKWrapper.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\gforce64.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\simpleble-c.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\MuseLib.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\BrainBitLib.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\GanglionLib.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\BrainFlowBluetooth.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\eego-SDK.dll
Unpacking to: C:\Users\me!\AppData\Local\Temp\jna--2013168224\BoardController.dll
I have logging set up and route the logging like this:
(defn configure-brainflow-logging!
"Configure BrainFlow logging to write to our application logs directory"
[]
(let [log-dir (str (System/getProperty "user.home") "/.lor/logs/device_logs")
log-file (str log-dir "/brainflow.log")]
(try
(BoardShim/enable_dev_board_logger)
(BoardShim/set_log_file log-file)
(BoardShim/set_log_level LogLevels/LEVEL_INFO)
(catch Exception e
(println "Failed to configure BrainFlow logging:" (.getMessage e))))))
(defn redirect-system-output! []
(let [log-file (str (System/getProperty "user.home") "/.lor/logs/app_logs/sys-out.log")
log-stream (java.io.PrintStream. (java.io.FileOutputStream. log-file false))]
(System/setOut log-stream)
(System/setErr log-stream)))
(redirect-system-output!)
But while this stops a lot of other logs, it doesn't stop the jna onesInteresting, I can't find Unpacking to anywhere in the JNA sources.
Are you sure it comes from JNA itself?
It could possibly be from the brainflow package itself. https://github.com/brainflow-dev/brainflow/blob/master/java_package/brainflow/pom.xml
Ah following your strategy, I looked up "Unpacking to" in the brainflow api and it led to this https://github.com/brainflow-dev/brainflow/blob/580f69354abbc0afc4612c4dbd1ea42538c0f84a/java_package/brainflow/src/main/java/brainflow/JarHelper.java#L27 at line 27
That's unfortunate. I would definitely create an issue on their GitHub asking to implement a more proper logging mechanism.
System/setErr should have worked, but maybe those lines are generated before the namespace where you call redirect-system-output! is loaded.
Thanks, I will and there is also a slack for just brainflow I might be able to reach out to as well. I will look into it.
Is there some smart way for a conversion like below? Anything shorter/prettier/faster than nested reduce-kv
{:a {:x 1 :y 2} :b {:y 3 :z 4}} -> {:x {:a 1} :y {:a 2 :b 3} :z {:b 4}}this isn't enough information to know the best way to perform that transformation
where does :y {:a 1} come from?
That one was a silly typo. Given a nested map, "flip it inside out" so that the inner maps' keys are in the outer map and vice versa
> Anything shorter/prettier/faster Maybe a library, could be Specter. But can't say for sure. Or https://stackoverflow.com/a/7290026/564509:
(let [input {:a {:x 1 :y 2} :b {:y 3 :z 4}}
expected {:x {:a 1} :y {:a 2 :b 3} :z {:b 4}}]
(= expected
(apply merge-with merge
(for [[ok ov] input
[ik iv] ov]
{ik {ok iv}}))))