summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorGuillaume Friloux <guillaume.friloux@gmail.com>2013-12-20 16:46:51 +0100
committerGuillaume Friloux <guillaume.friloux@gmail.com>2013-12-20 16:46:51 +0100
commit67efd371f4c5f17bbecb7e0dbe60f00ee00c03ec (patch)
tree20765b30c4c855c4841b11c6f2e94f247111c652 /src/lib
parentceac6266f34b4c014fa5c95c467a9c382579265c (diff)
Make Smman able to filter logs and tag them.
Next step is turning logs into JSON and send them to ES.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.mk3
-rw-r--r--src/lib/rules/rules_private.h2
-rw-r--r--src/lib/spy/spy_file.c15
-rw-r--r--src/lib/spy/spy_line.c14
-rw-r--r--src/lib/spy/spy_main.c2
5 files changed, 22 insertions, 14 deletions
diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk
index 860a1b4..bb78459 100644
--- a/src/lib/Makefile.mk
+++ b/src/lib/Makefile.mk
@@ -14,8 +14,9 @@ src_lib_libconf_la_CFLAGS = $(LIBS_CFLAGS) $(EXTRA_CPPFLAGS)
14src_lib_libconf_la_LDFLAGS = $(LIBS_LIBS) 14src_lib_libconf_la_LDFLAGS = $(LIBS_LIBS)
15 15
16src_lib_libspy_la_SOURCES = \ 16src_lib_libspy_la_SOURCES = \
17src/lib/spy/spy_file.c \
18src/lib/spy/spy_main.c \ 17src/lib/spy/spy_main.c \
18src/lib/spy/spy_file.c \
19src/lib/spy/spy_line.c \
19src/lib/spy/spy_private.h \ 20src/lib/spy/spy_private.h \
20src/include/Spy.h 21src/include/Spy.h
21src_lib_libspy_la_CFLAGS = $(LIBS_CFLAGS) $(EXTRA_CPPFLAGS) 22src_lib_libspy_la_CFLAGS = $(LIBS_CFLAGS) $(EXTRA_CPPFLAGS)
diff --git a/src/lib/rules/rules_private.h b/src/lib/rules/rules_private.h
index f20293e..1d74d95 100644
--- a/src/lib/rules/rules_private.h
+++ b/src/lib/rules/rules_private.h
@@ -27,8 +27,6 @@ typedef struct _Rules_Load
27 } cb; 27 } cb;
28} Rules_Load; 28} Rules_Load;
29 29
30void rules_rule_free(Rule *rule);
31
32Eina_Bool rules_load_ls_filter(void *data, Eio_File *handler, const Eina_File_Direct_Info *info); 30Eina_Bool rules_load_ls_filter(void *data, Eio_File *handler, const Eina_File_Direct_Info *info);
33void rules_load_ls(void *data, Eio_File *handler, const Eina_File_Direct_Info *info); 31void rules_load_ls(void *data, Eio_File *handler, const Eina_File_Direct_Info *info);
34void rules_load_ls_done(void *data, Eio_File *handler); 32void rules_load_ls_done(void *data, Eio_File *handler);
diff --git a/src/lib/spy/spy_file.c b/src/lib/spy/spy_file.c
index 49efbbf..944f326 100644
--- a/src/lib/spy/spy_file.c
+++ b/src/lib/spy/spy_file.c
@@ -87,7 +87,7 @@ _spy_file_cb(void *data,
87 return; 87 return;
88 } 88 }
89 89
90 fseeko(sf->read.fd, sf->read.offset, SEEK_SET); 90 fseeko(sf->read.fd, sf->read.offset - 1, SEEK_SET);
91 left = sf->read.length; 91 left = sf->read.length;
92 92
93 while (nbr != (size_t)sf->read.length) 93 while (nbr != (size_t)sf->read.length)
@@ -185,15 +185,9 @@ spy_file_poll(void *data)
185} 185}
186 186
187const char * 187const char *
188spy_line_get(Spy_Line *sl)
189{
190 return sl->line;
191}
192
193
194const char *
195spy_file_name_get(Spy_File *sf) 188spy_file_name_get(Spy_File *sf)
196{ 189{
190 EINA_SAFETY_ON_NULL_RETURN_VAL(sf, NULL);
197 return sf->name; 191 return sf->name;
198} 192}
199 193
@@ -204,8 +198,9 @@ spy_file_data_set(Spy_File *sf,
204 sf->data = (const void *)data; 198 sf->data = (const void *)data;
205} 199}
206 200
207const void * 201void *
208spy_file_data_get(Spy_File *sf) 202spy_file_data_get(Spy_File *sf)
209{ 203{
210 return sf->data; 204 EINA_SAFETY_ON_NULL_RETURN_VAL(sf, NULL);
205 return (void *)sf->data;
211} 206}
diff --git a/src/lib/spy/spy_line.c b/src/lib/spy/spy_line.c
new file mode 100644
index 0000000..0768027
--- /dev/null
+++ b/src/lib/spy/spy_line.c
@@ -0,0 +1,14 @@
1#include "spy_private.h"
2
3const char *
4spy_line_get(Spy_Line *sl)
5{
6 return sl->line;
7}
8
9Spy_File *
10spy_line_spyfile_get(Spy_Line *sl)
11{
12 return sl->sf;
13}
14
diff --git a/src/lib/spy/spy_main.c b/src/lib/spy/spy_main.c
index 139afed..bb171b3 100644
--- a/src/lib/spy/spy_main.c
+++ b/src/lib/spy/spy_main.c
@@ -90,7 +90,7 @@ spy_file_new(Spy *spy, const char *file)
90 } 90 }
91 91
92 sf->poll.size = st.st_size; 92 sf->poll.size = st.st_size;
93 sf->poll.timer = ecore_timer_add(5.0, spy_file_poll, sf); 93 sf->poll.timer = ecore_timer_add(0.3, spy_file_poll, sf);
94 94
95 spy->files = eina_inlist_append(spy->files, EINA_INLIST_GET(sf)); 95 spy->files = eina_inlist_append(spy->files, EINA_INLIST_GET(sf));
96 DBG("spy_file[%p] size[%zd]", sf, st.st_size); 96 DBG("spy_file[%p] size[%zd]", sf, st.st_size);