Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only log to a file without logging to stderr #799

Closed
jian-lin opened this issue Jan 25, 2024 · 3 comments · Fixed by #809
Closed

Only log to a file without logging to stderr #799

jian-lin opened this issue Jan 25, 2024 · 3 comments · Fixed by #809

Comments

@jian-lin
Copy link

Is your feature request related to a problem? Please describe.

If Emacs runs inside a terminal emulator, using emacs-rime destroys the current screen of Emacs because librime logs to stderr.

emacs-rime-stderr-bug

Describe the solution you'd like
I want to be able to not log to stderr when logging is enabled.

Additional context

Removing this single line is a possible implementation. However, in that case, you have to set log_dir to an empty string to log to stderr, which is not very intuitive. In addition, this seems to be a breaking change.

FLAGS_alsologtostderr = true;

Maybe a new option should be added to rime api for this new feature.

@lotem
Copy link
Member

lotem commented Feb 6, 2024

I guess a compile-time flag should work for emacs-rime?
How about creating a new CMake option LOG_TO_STDERR, and use it to fill the value with a C macro

FLAGS_alsologtostderr = RIME_LOG_TO_STDERR;

lotem added a commit to lotem/librime that referenced this issue Feb 6, 2024
allow turning on/off glog's alsologtostderr flag in custom build.
by default OFF in release build, ON in debug build.

Fixes rime#799
@jian-lin
Copy link
Author

jian-lin commented Feb 7, 2024

I guess a compile-time flag should work for emacs-rime?

If possible, I want to use librime from my Linux distribution instead of changing cmake options and compiling it myself. So both a cmake option defaulting to off (the linked PR) and a rime api option work well for me.

@lotem
Copy link
Member

lotem commented Feb 7, 2024

OK. I think it's appropriate to only enable logging to stderr in debug build.

@lotem lotem closed this as completed in #809 Feb 8, 2024
lotem added a commit that referenced this issue Feb 8, 2024
allow turning on/off glog's alsologtostderr flag in custom build.
by default OFF in release build, ON in debug build.

Fixes #799
graphemecluster pushed a commit to TypeDuck-HK/librime that referenced this issue Mar 18, 2024
allow turning on/off glog's alsologtostderr flag in custom build.
by default OFF in release build, ON in debug build.

Fixes rime#799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants