logf changes:

* Disable logf by default and allow per-file enabling with "#define LOGF_ENABLE". To enable globally add that define in the config.h file.
* Transform logf calls into DEBUGF calls when ROCKBOX_HAS_LOGF isn't defined, so that they get printed to the console in the sim.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15291 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Nicolas Pennequin 2007-10-24 22:06:36 +00:00
parent 4c22f0bf73
commit fb70952228
3 changed files with 20 additions and 6 deletions

View file

@ -30,7 +30,6 @@
#include "file.h"
#include "kernel.h"
#include "sprintf.h"
#include "logf.h"
#include "screens.h"
#include "misc.h"
#include "mas.h"
@ -51,6 +50,9 @@
#include "splash.h"
#include "general.h"
#define LOGF_ENABLE
#include "logf.h"
#ifdef SIMULATOR
#if CONFIG_CODEC == SWCODEC
unsigned char codecbuf[CODEC_SIZE];

View file

@ -46,7 +46,6 @@
#include "settings.h"
#include "codecs.h"
#include "audio.h"
#include "logf.h"
#include "mp3_playback.h"
#include "usb.h"
#include "status.h"
@ -98,13 +97,17 @@
* for their correct seeek target, 32k seems a good size */
#define AUDIO_REBUFFER_GUESS_SIZE (1024*32)
/* Define LOGF_ENABLE to enable logf output in this file */
/*#define LOGF_ENABLE*/
#include "logf.h"
/* macros to enable logf for queues
logging on SYS_TIMEOUT can be disabled */
#ifdef SIMULATOR
/* Define this for logf output of all queuing except SYS_TIMEOUT */
#define PLAYBACK_LOGQUEUES
/* Define this to logf SYS_TIMEOUT messages */
#define PLAYBACK_LOGQUEUES_SYS_TIMEOUT
/*#define PLAYBACK_LOGQUEUES_SYS_TIMEOUT*/
#endif
#ifdef PLAYBACK_LOGQUEUES
@ -3556,7 +3559,7 @@ static void audio_reset_buffer(void)
/* Clear any references to the file buffer */
buffer_state = BUFFER_STATE_INITIALIZED;
#ifdef ROCKBOX_HAS_LOGF
#if defined(ROCKBOX_HAS_LOGF) && defined(LOGF_ENABLE)
/* Make sure everything adds up - yes, some info is a bit redundant but
aids viewing and the sumation of certain variables should add up to
the location of others. */

View file

@ -21,6 +21,7 @@
#include <config.h>
#include <stdbool.h>
#include "../include/_ansi.h"
#include "debug.h"
#ifdef ROCKBOX_HAS_LOGF
@ -38,8 +39,16 @@ extern bool logfwrap;
void _logf(const char *format, ...) ATTRIBUTE_PRINTF(1, 2);
#else /* !ROCKBOX_HAS_LOGF */
/* built without logf() support enabled */
#define logf(...)
/* built without logf() support enabled, replace logf() by DEBUGF() */
#define logf(f,args...) DEBUGF(f"\n",##args)
#endif /* !ROCKBOX_HAS_LOGF */
#endif /* LOGF_H */
/* Allow fine tuning (per file) of the logf output */
#ifndef LOGF_ENABLE
#undef logf
#define logf(...)
#endif