18f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin/* 28f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * Copyright (C) 2010 The Android Open Source Project 38f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * 48f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * Licensed under the Apache License, Version 2.0 (the "License"); 58f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * you may not use this file except in compliance with the License. 68f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * You may obtain a copy of the License at 78f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * 88f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * http://www.apache.org/licenses/LICENSE-2.0 98f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * 108f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * Unless required by applicable law or agreed to in writing, software 118f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * distributed under the License is distributed on an "AS IS" BASIS, 128f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * See the License for the specific language governing permissions and 148f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin * limitations under the License. 158f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin */ 168f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin 178f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#ifndef _CUTILS_KLOG_H_ 188f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#define _CUTILS_KLOG_H_ 198f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin 208f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavinvoid klog_init(void); 218f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavinvoid klog_set_level(int level); 228f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavinvoid klog_close(void); 238f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavinvoid klog_write(int level, const char *fmt, ...) 248f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin __attribute__ ((format(printf, 2, 3))); 258f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin 268f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#define KLOG_ERROR(tag,x...) klog_write(3, "<3>" tag ": " x) 278f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#define KLOG_WARNING(tag,x...) klog_write(4, "<4>" tag ": " x) 288f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#define KLOG_NOTICE(tag,x...) klog_write(5, "<5>" tag ": " x) 298f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#define KLOG_INFO(tag,x...) klog_write(6, "<6>" tag ": " x) 308f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#define KLOG_DEBUG(tag,x...) klog_write(7, "<7>" tag ": " x) 318f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin 328f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#define KLOG_DEFAULT_LEVEL 3 /* messages <= this level are logged */ 338f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin 348f91282ebe1963b9d27f8779ad1342302b293bd2Dima Zavin#endif 35