Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f91282e authored by Dima Zavin's avatar Dima Zavin
Browse files

init/cutils: move kernel logging interface to libcutils from init



Change-Id: Ia0f91b1fcd6cae69d76bf3dd841340958db938a8
Signed-off-by: default avatarDima Zavin <dima@android.com>
parent 2d55e02d
Loading
Loading
Loading
Loading

include/cutils/klog.h

0 → 100644
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _CUTILS_KLOG_H_
#define _CUTILS_KLOG_H_

void klog_init(void);
void klog_set_level(int level);
void klog_close(void);
void klog_write(int level, const char *fmt, ...)
    __attribute__ ((format(printf, 2, 3)));

#define KLOG_ERROR(tag,x...)   klog_write(3, "<3>" tag ": " x)
#define KLOG_WARNING(tag,x...) klog_write(4, "<4>" tag ": " x)
#define KLOG_NOTICE(tag,x...)  klog_write(5, "<5>" tag ": " x)
#define KLOG_INFO(tag,x...)    klog_write(6, "<6>" tag ": " x)
#define KLOG_DEBUG(tag,x...)   klog_write(7, "<7>" tag ": " x)

#define KLOG_DEFAULT_LEVEL  3  /* messages <= this level are logged */

#endif
+1 −1
Original line number Diff line number Diff line
@@ -663,7 +663,7 @@ int do_chmod(int nargs, char **args) {

int do_loglevel(int nargs, char **args) {
    if (nargs == 2) {
        log_set_level(atoi(args[1]));
        klog_set_level(atoi(args[1]));
        return 0;
    }
    return -1;
+1 −1
Original line number Diff line number Diff line
@@ -724,7 +724,7 @@ int main(int argc, char **argv)
         * talk to the outside world.
         */
    open_devnull_stdio();
    log_init();
    klog_init();
    
    INFO("reading config file\n");
    init_parse_config_file("/init.rc");
+4 −9
Original line number Diff line number Diff line
@@ -17,17 +17,12 @@
#ifndef _INIT_LOG_H_
#define _INIT_LOG_H_

void log_init(void);
void log_set_level(int level);
void log_close(void);
void log_write(int level, const char *fmt, ...)
    __attribute__ ((format(printf, 2, 3)));
#include <cutils/klog.h>

#define ERROR(x...)   log_write(3, "<3>init: " x)
#define NOTICE(x...)  log_write(5, "<5>init: " x)
#define INFO(x...)    log_write(6, "<6>init: " x)
#define ERROR(x...)   KLOG_ERROR("init", x)
#define NOTICE(x...)  KLOG_NOTICE("init", x)
#define INFO(x...)    KLOG_INFO("init", x)

#define LOG_DEFAULT_LEVEL  3  /* messages <= this level are logged */
#define LOG_UEVENTS        0  /* log uevent messages if 1. verbose */

#endif
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ int ueventd_main(int argc, char **argv)
    signal(SIGCHLD, SIG_IGN);

    open_devnull_stdio();
    log_init();
    klog_init();

    INFO("starting ueventd\n");

Loading