cogentcore / core

A free and open source framework for building powerful, fast, and elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the Web with a single pure Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.31k stars 71 forks source link

Crashlog should have OS version too ? #967

Open gedw99 opened 1 month ago

gedw99 commented 1 month ago

Describe the bug

Here is what we get currently on this version in a crash log.

Platform: MacOS
System platform: MacOS
App version: v0.1.3
Core version: v0.1.3
Time: 2024-05-19 12:15:03

Its very good, but often there are bugs that are different for different versions of an OS, so it would be useful if we also collect the OS version.

It would be good too because we MAY at runtime have to sniff the OS version and do something slightly different for workarounds. This is common int he games industry where different OS versions and even different graphics card models can require special hack fixes.

Hence the OS version code can be used at runtime too. SO we are reusing the code.

How to reproduce

make something crash and see the logs.

Example code

No response

Relevant output

No response

Platform

macOS

kkoreilly commented 1 month ago

I agree that this would be nice. I did some research and it doesn't seem like there is an easy way to get the os version on all platforms; if you can find a way to do that, that would be great! There is some discussion on this thread: https://groups.google.com/g/golang-nuts/c/NzEPGqlHIYQ.

gedw99 commented 1 month ago

the requirement is for web, desktop and mobile I presume ?

I had a look and there is no obvious packages out there that do this sniffin for us.

So I think k this just not worth the heavy effort for such small returns.

kkoreilly commented 1 month ago

Yep, we need web, desktop, and mobile. Web should be easy, as we can just use the user agent string. I'm not sure about the other platforms though. I think it would be nice to have the OS version and the version of the graphics driver, but it isn't a very high priority, so I will leave this open but mark it as low priority, and we can come back to it later.

gedw99 commented 1 month ago

Yep I agree. We can probably do this in 2 phases and get a very basic Desktop and Mobile sniffer going. There is no golang package out there that I saw.

I saw that the Open Telemetry package has a data type for collecting this data actually too. So can dovetail it with that if we want later. "os.version" is the links below, and other meta data.

https://opentelemetry.io/docs/specs/semconv/resource/os/

https://github.com/open-telemetry/opentelemetry-go/blob/main/semconv/v1.9.0/resource.go

For web there are some good packages with no dependencies in golang. These are server side detectors of course.

kkoreilly commented 1 month ago

Yep, we don't want to depend on any server side things. I can definitely do the web version information soon once I finish this configuration rewrite, and if you can figure out a native way to get the desktop/mobile version, I would consider a PR for that.

gedw99 commented 1 month ago

Got it . I will work on the desktop / mobile. Very doable.

kkoreilly commented 2 weeks ago

I implemented this on web in 6535cc3 using userAgent with a new system.App.SystemInfo method that can also be implemented on other platforms.