Tizen 2.0 Release
[framework/system/dlog.git] / include / logger.h
1 /*
2  * DLOG
3  * Copyright (c) 2005-2008, The Android Open Source Project
4  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the License);
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #ifndef _UTILS_LOGGER_H
20 #define _UTILS_LOGGER_H
21
22 #include <stdint.h>
23
24 struct logger_entry {
25     uint16_t    len;    /* length of the payload */
26     uint16_t    __pad;  /* no matter what, we get 2 bytes of padding */
27     int32_t     pid;    /* generating process's pid */
28     int32_t     tid;    /* generating process's tid */
29     int32_t     sec;    /* seconds since Epoch */
30     int32_t     nsec;   /* nanoseconds */
31     char        msg[0]; /* the entry's payload */
32 };
33
34 #define LOGGER_LOG_MAIN         "log_main"
35 #define LOGGER_LOG_RADIO        "log_radio"
36 #define LOGGER_LOG_SYSTEM       "log_system"
37 #define LOGGER_LOG_APPS         "log_apps"
38
39 #define LOGGER_ENTRY_MAX_LEN            (4*1024)
40 #define LOGGER_ENTRY_MAX_PAYLOAD        (LOGGER_ENTRY_MAX_LEN - sizeof(struct logger_entry))
41
42 //#ifdef HAVE_IOCTL
43
44 #include <sys/ioctl.h>
45
46 #define __LOGGERIO      0xAE
47
48 #define LOGGER_GET_LOG_BUF_SIZE         _IO(__LOGGERIO, 1) /* size of log */
49 #define LOGGER_GET_LOG_LEN              _IO(__LOGGERIO, 2) /* used log len */
50 #define LOGGER_GET_NEXT_ENTRY_LEN       _IO(__LOGGERIO, 3) /* next entry len */
51 #define LOGGER_FLUSH_LOG                _IO(__LOGGERIO, 4) /* flush log */
52
53 //#endif // HAVE_IOCTL
54
55 #endif /* _UTILS_LOGGER_H */