Split logging internals so that platforms may choose additional or alternate spew mechanisms

In the case of windows, allow for the OutputDebugString call in addition to logging to stderr.
Useful for the dll scenario and debugging in Visual Studio.
This commit is contained in:
Alex Lian
2013-03-03 17:38:19 -05:00
committed by Philippe Teuwen
parent 563054d2a2
commit b3c6ea86ad
5 changed files with 122 additions and 5 deletions

41
libnfc/log_posix.c Normal file
View File

@@ -0,0 +1,41 @@
/*-
* Copyright (C) 2011 Romain Tartière
* Copyright (C) 2011, 2012 Romuald Conty
* Copyright (C) 2013 Alex Lian
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, 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 Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#include "log.h"
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdarg.h>
void
log_vput_internal(const char *format, va_list args)
{
vfprintf(stderr, format, args);
}
void
log_put_internal(const char *format, ...)
{
va_list va;
va_start(va, format);
vfprintf(stderr, format, va);
va_end(va);
}