2 * @file miranda-debug.c
6 * Copyright (C) 2010-11 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #include "newpluginapi.h"
30 #include "m_protosvc.h"
31 #include "m_protoint.h"
34 #include "sipe-backend.h"
35 #include "miranda-private.h"
37 extern HANDLE sipe_miranda_incoming_netlibuser
;
38 extern CRITICAL_SECTION sipe_miranda_debug_CriticalSection
;
40 void sipe_backend_debug_literal(sipe_debug_level level
,
43 if (sipe_miranda_incoming_netlibuser
)
45 gchar
*msg
= g_strdup_printf("[%5d] %s", GetCurrentThreadId(), message
);
46 EnterCriticalSection(&sipe_miranda_debug_CriticalSection
);
47 CallService(MS_NETLIB_LOG
, (WPARAM
)sipe_miranda_incoming_netlibuser
, (LPARAM
)msg
);
48 LeaveCriticalSection(&sipe_miranda_debug_CriticalSection
);
53 void sipe_backend_debug(sipe_debug_level level
,
55 ...) G_GNUC_PRINTF(2, 3)
61 if (sipe_backend_debug_enabled()) {
62 gchar
*msg
= g_strdup_vprintf(format
, ap
);
63 sipe_backend_debug_literal(level
, msg
);
70 gboolean
sipe_backend_debug_enabled(void)