2
0
mirror of synced 2025-02-22 22:38:18 +00:00
mobile/internal/mobileinit/mobileinit_ios.go
David Crawshaw 905c19f8c0 internal/mobileinit: remove format string warning
Change-Id: I9b0e9680395dcfdf0e6c03a5847ea619e570a2ed
Reviewed-on: https://go-review.googlesource.com/13918
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-08-25 16:39:13 +00:00

39 lines
660 B
Go

// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin
// +build arm arm64
package mobileinit
import (
"io"
"log"
"os"
"unsafe"
)
/*
#include <asl.h>
#include <stdlib.h>
void asl_log_wrap(const char *str) {
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "%s", str);
}
*/
import "C"
type aslWriter struct{}
func (aslWriter) Write(p []byte) (n int, err error) {
cstr := C.CString(string(p))
C.asl_log_wrap(cstr)
C.free(unsafe.Pointer(cstr))
return len(p), nil
}
func init() {
log.SetOutput(io.MultiWriter(os.Stderr, aslWriter{}))
}