-
-
Notifications
You must be signed in to change notification settings - Fork 158
/
Copy pathlog-message-dispatch.c
58 lines (49 loc) · 1.5 KB
/
log-message-dispatch.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* SNOOPY COMMAND LOGGER
*
* Copyright (c) 2014 Bostjan Skufca Jese <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* Includes order: from local to global
*/
#include "log-message-dispatch.h"
#include "snoopy.h"
#include "outputregistry.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* snoopy_action_log_message_dispatch
*
* Description:
* Dispatch given message to configured output
*
* Params:
* logMessage: message to dispatch
*
* Return:
* int: See snoopy.h (SNOOPY_OUTPUT_*) for details.
*/
int snoopy_action_log_message_dispatch (const char *logMessage)
{
/* Dispatch only if non-zero size */
if (0 == strlen(logMessage)) {
return SNOOPY_OUTPUT_GRACEFUL_DISCARD;
}
// Dispatch to configured output
return snoopy_outputregistry_dispatch(logMessage);
}