summaryrefslogtreecommitdiff
path: root/include/efl.eina.pxd
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2013-10-23 14:34:42 +0300
committerKai Huuhko <kai.huuhko@gmail.com>2013-10-23 14:34:42 +0300
commit7fbab02702bb1318a7519fd80833ad0856c33812 (patch)
tree69b2a3a876204a1237008239b2c33a69dceaaec6 /include/efl.eina.pxd
parentcd25ef3488603bb88c108884c77df4a3c23105fc (diff)
First attempt at integrating Eina Log with Python logging.
Has two loggers: efl and efl.eo. To test, add handlers, formatters etc. and change levels using normal Python logging utilities. The test messages come from efl.eo init and class registration.
Diffstat (limited to 'include/efl.eina.pxd')
-rw-r--r--include/efl.eina.pxd50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/efl.eina.pxd b/include/efl.eina.pxd
index 1da12ce..9e11dde 100644
--- a/include/efl.eina.pxd
+++ b/include/efl.eina.pxd
@@ -15,6 +15,7 @@
15# You should have received a copy of the GNU Lesser General Public License 15# You should have received a copy of the GNU Lesser General Public License
16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. 16# along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>.
17 17
18from cpython cimport va_list
18from libc.stdlib cimport const_void, malloc, free 19from libc.stdlib cimport const_void, malloc, free
19from libc.string cimport const_char, memcpy, strdup 20from libc.string cimport const_char, memcpy, strdup
20 21
@@ -38,6 +39,18 @@ cdef extern from "Eina.h":
38 #################################################################### 39 ####################################################################
39 # Enumerations 40 # Enumerations
40 # 41 #
42 ctypedef enum Eina_Log_Level:
43 EINA_LOG_LEVEL_CRITICAL # Critical log level
44 EINA_LOG_LEVEL_ERR # Error log level
45 EINA_LOG_LEVEL_WARN # Warning log level
46 EINA_LOG_LEVEL_INFO # Information log level
47 EINA_LOG_LEVEL_DBG # Debug log level
48 EINA_LOG_LEVELS # Count of default log levels
49 EINA_LOG_LEVEL_UNKNOWN = (-2147483647 - 1) # Unknown level
50
51 ctypedef enum Eina_Log_State:
52 EINA_LOG_STATE_START
53 EINA_LOG_STATE_STOP
41 54
42 #################################################################### 55 ####################################################################
43 # Basic Types 56 # Basic Types
@@ -78,11 +91,22 @@ cdef extern from "Eina.h":
78 void *(*get_container)(Eina_Iterator *it) 91 void *(*get_container)(Eina_Iterator *it)
79 void (*free)(Eina_Iterator *it) 92 void (*free)(Eina_Iterator *it)
80 93
94 ctypedef struct Eina_Log_Domain:
95 int level # Max level to log
96 const char *domain_str # Formatted string with color to print
97 const char *name # Domain name
98 size_t namelen # strlen(name)
99 ctypedef Eina_Log_Domain const_Eina_Log_Domain "const Eina_Log_Domain"
100
81 #################################################################### 101 ####################################################################
82 # Other typedefs 102 # Other typedefs
83 # 103 #
84 ctypedef int (*Eina_Compare_Cb)(const_void *data1, const_void *data2) 104 ctypedef int (*Eina_Compare_Cb)(const_void *data1, const_void *data2)
85 ctypedef void (*Eina_Free_Cb)(void *data) 105 ctypedef void (*Eina_Free_Cb)(void *data)
106 ctypedef void (*Eina_Log_Print_Cb)(const_Eina_Log_Domain *d,
107 Eina_Log_Level level,
108 const_char *file, const_char *fnc, int line,
109 const_char *fmt, void *data, va_list args)
86 110
87 #################################################################### 111 ####################################################################
88 # Functions 112 # Functions
@@ -142,3 +166,29 @@ cdef extern from "Eina.h":
142 Eina_Bool eina_hash_add(Eina_Hash *hash, const_void *key, const_void *data) 166 Eina_Bool eina_hash_add(Eina_Hash *hash, const_void *key, const_void *data)
143 Eina_Bool eina_hash_del(Eina_Hash *hash, const_void *key, const_void *data) 167 Eina_Bool eina_hash_del(Eina_Hash *hash, const_void *key, const_void *data)
144 void *eina_hash_find(Eina_Hash *hash, const_void *key) 168 void *eina_hash_find(Eina_Hash *hash, const_void *key)
169
170 void eina_log_threads_enable()
171 void eina_log_print_cb_set(Eina_Log_Print_Cb cb, void *data)
172 void eina_log_level_set(int level)
173 int eina_log_level_get()
174 Eina_Bool eina_log_main_thread_check()
175 void eina_log_function_disable_set(Eina_Bool disabled)
176 Eina_Bool eina_log_function_disable_get()
177 void eina_log_domain_level_set(const_char *domain_name, int level)
178 int eina_log_domain_level_get(const_char *domain_name)
179 int eina_log_domain_registered_level_get(int domain)
180 int eina_log_domain_register(const_char *name, const_char *color)
181 void eina_log_domain_unregister(int domain)
182 void eina_log_print(int domain,
183 Eina_Log_Level level,
184 const_char *file,
185 const_char *fnc,
186 int line,
187 const_char *fmt,
188 ...)
189
190 void EINA_LOG_DOM_CRIT(int DOM, const_char *fmt, ...)
191 void EINA_LOG_DOM_ERR(int DOM, const_char *fmt, ...)
192 void EINA_LOG_DOM_WARN(int DOM, const_char *fmt, ...)
193 void EINA_LOG_DOM_INFO(int DOM, const_char *fmt, ...)
194 void EINA_LOG_DOM_DBG(int DOM, const_char *fmt, ...)