Move init to libbase logging.
Change-Id: Ibfbefeff587a69e948978a037c555fd12a5ade6a
diff --git a/init/watchdogd.cpp b/init/watchdogd.cpp
index 0d16db9..3a3d810 100644
--- a/init/watchdogd.cpp
+++ b/init/watchdogd.cpp
@@ -29,8 +29,7 @@
int watchdogd_main(int argc, char **argv) {
open_devnull_stdio();
- klog_init();
- klog_set_level(KLOG_NOTICE_LEVEL);
+ InitKernelLogging(argv);
int interval = 10;
if (argc >= 2) interval = atoi(argv[1]);
@@ -38,30 +37,31 @@
int margin = 10;
if (argc >= 3) margin = atoi(argv[2]);
- NOTICE("started (interval %d, margin %d)!\n", interval, margin);
+ LOG(INFO) << "watchdogd started (interval " << interval << ", margin " << margin << ")!";
int fd = open(DEV_NAME, O_RDWR|O_CLOEXEC);
if (fd == -1) {
- ERROR("Failed to open %s: %s\n", DEV_NAME, strerror(errno));
+ PLOG(ERROR) << "Failed to open " << DEV_NAME;
return 1;
}
int timeout = interval + margin;
int ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
if (ret) {
- ERROR("Failed to set timeout to %d: %s\n", timeout, strerror(errno));
+ PLOG(ERROR) << "Failed to set timeout to " << timeout;
ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
if (ret) {
- ERROR("Failed to get timeout: %s\n", strerror(errno));
+ PLOG(ERROR) << "Failed to get timeout";
} else {
if (timeout > margin) {
interval = timeout - margin;
} else {
interval = 1;
}
- WARNING("Adjusted interval to timeout returned by driver:"
- " timeout %d, interval %d, margin %d\n",
- timeout, interval, margin);
+ LOG(WARNING) << "Adjusted interval to timeout returned by driver: "
+ << "timeout " << timeout
+ << ", interval " << interval
+ << ", margin " << margin;
}
}