forked from joejulian/gio
ui/app: use log level info for stderr
It's not given that output to stderr is caused by an error condition. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -22,11 +22,11 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
// Android's logcat already includes timestamps.
|
// Android's logcat already includes timestamps.
|
||||||
log.SetFlags(log.Flags() &^ log.LstdFlags)
|
log.SetFlags(log.Flags() &^ log.LstdFlags)
|
||||||
logFd(C.ANDROID_LOG_INFO, os.Stdout.Fd())
|
logFd(os.Stdout.Fd())
|
||||||
logFd(C.ANDROID_LOG_ERROR, os.Stderr.Fd())
|
logFd(os.Stderr.Fd())
|
||||||
}
|
}
|
||||||
|
|
||||||
func logFd(prio C.int, fd uintptr) {
|
func logFd(fd uintptr) {
|
||||||
r, w, err := os.Pipe()
|
r, w, err := os.Pipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@@ -49,7 +49,7 @@ func logFd(prio C.int, fd uintptr) {
|
|||||||
}
|
}
|
||||||
copy(buf, line)
|
copy(buf, line)
|
||||||
buf[len(line)] = 0
|
buf[len(line)] = 0
|
||||||
C.__android_log_write(prio, tag, cbuf)
|
C.__android_log_write(C.ANDROID_LOG_INFO, tag, cbuf)
|
||||||
}
|
}
|
||||||
// The garbage collector doesn't know that w's fd was dup'ed.
|
// The garbage collector doesn't know that w's fd was dup'ed.
|
||||||
// Avoid finalizing w, and thereby avoid its finalizer closing its fd.
|
// Avoid finalizing w, and thereby avoid its finalizer closing its fd.
|
||||||
|
|||||||
Reference in New Issue
Block a user