1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Lots of patches committable now that my sound card works properly again.

logging API changed slightly (I got sick of gcc warnings about deprecated
features).

resampling (for live input, not yet for reencoding) is in there.

several patches from Karl Heyes have been incorporated.

svn path=/trunk/log/; revision=3751
This commit is contained in:
Michael Smith 2002-08-03 08:14:56 +00:00
parent a2d5cbd219
commit 78c08c5f10
3 changed files with 18 additions and 17 deletions

View File

@ -160,7 +160,8 @@ void log_shutdown()
_initialized = 0; _initialized = 0;
} }
void log_write(int log_id, int priority, const char *cat, const char *fmt, ...) void log_write(int log_id, int priority, const char *cat, const char *func,
const char *fmt, ...)
{ {
static char prior[4][5] = { "EROR\0", "WARN\0", "INFO\0", "DBUG\0" }; static char prior[4][5] = { "EROR\0", "WARN\0", "INFO\0", "DBUG\0" };
char tyme[128]; char tyme[128];
@ -181,7 +182,7 @@ void log_write(int log_id, int priority, const char *cat, const char *fmt, ...)
now = time(NULL); now = time(NULL);
strftime(tyme, 128, "[%Y-%m-%d %H:%M:%S]", localtime(&now)); strftime(tyme, 128, "[%Y-%m-%d %H:%M:%S]", localtime(&now));
snprintf(pre, 256, "%s %s", prior[priority-1], cat); snprintf(pre, 256, "%s %s%s", prior[priority-1], cat, func);
fprintf(loglist[log_id].logfile, "%s %s %s\n", tyme, pre, line); fprintf(loglist[log_id].logfile, "%s %s %s\n", tyme, pre, line);

View File

@ -20,7 +20,8 @@ void log_reopen(int log_id);
void log_close(int log_id); void log_close(int log_id);
void log_shutdown(); void log_shutdown();
void log_write(int log_id, int priority, const char *cat, const char *fmt, ...); void log_write(int log_id, int priority, const char *cat, const char *func,
const char *fmt, ...);
void log_write_direct(int log_id, const char *fmt, ...); void log_write_direct(int log_id, const char *fmt, ...);
#endif /* __LOG_H__ */ #endif /* __LOG_H__ */

View File

@ -47,22 +47,22 @@
#endif #endif
#define CATMODULE "thread" #define CATMODULE "thread"
#define LOG_ERROR(y) log_write(_logid, 1, CATMODULE "/" __FUNCTION__, y) #define LOG_ERROR(y) log_write(_logid, 1, CATMODULE "/", __FUNCTION__, y)
#define LOG_ERROR3(y, z1, z2, z3) log_write(_logid, 1, CATMODULE "/" __FUNCTION__, y, z1, z2, z3) #define LOG_ERROR3(y, z1, z2, z3) log_write(_logid, 1, CATMODULE "/", __FUNCTION__, y, z1, z2, z3)
#define LOG_ERROR7(y, z1, z2, z3, z4, z5, z6, z7) log_write(_logid, 1, CATMODULE "/" __FUNCTION__, y, z1, z2, z3, z4, z5, z6, z7) #define LOG_ERROR7(y, z1, z2, z3, z4, z5, z6, z7) log_write(_logid, 1, CATMODULE "/", __FUNCTION__, y, z1, z2, z3, z4, z5, z6, z7)
#define LOG_WARN(y) log_write(_logid, 2, CATMODULE "/" __FUNCTION__, y) #define LOG_WARN(y) log_write(_logid, 2, CATMODULE "/", __FUNCTION__, y)
#define LOG_WARN3(y, z1, z2, z3) log_write(_logid, 2, CATMODULE "/" __FUNCTION__, y, z1, z2, z3) #define LOG_WARN3(y, z1, z2, z3) log_write(_logid, 2, CATMODULE "/", __FUNCTION__, y, z1, z2, z3)
#define LOG_WARN5(y, z1, z2, z3, z4, z5) log_write(_logid, 2, CATMODULE "/" __FUNCTION__, y, z1, z2, z3, z4, z5) #define LOG_WARN5(y, z1, z2, z3, z4, z5) log_write(_logid, 2, CATMODULE "/", __FUNCTION__, y, z1, z2, z3, z4, z5)
#define LOG_WARN7(y, z1, z2, z3, z4, z5, z6, z7) log_write(_logid, 2, CATMODULE "/" __FUNCTION__, y, z1, z2, z3, z4, z5, z6, z7) #define LOG_WARN7(y, z1, z2, z3, z4, z5, z6, z7) log_write(_logid, 2, CATMODULE "/", __FUNCTION__, y, z1, z2, z3, z4, z5, z6, z7)
#define LOG_INFO(y) log_write(_logid, 3, CATMODULE "/" __FUNCTION__, y) #define LOG_INFO(y) log_write(_logid, 3, CATMODULE "/", __FUNCTION__, y)
#define LOG_INFO4(y, z1, z2, z3, z4) log_write(_logid, 3, CATMODULE "/" __FUNCTION__, y, z1, z2, z3, z4) #define LOG_INFO4(y, z1, z2, z3, z4) log_write(_logid, 3, CATMODULE "/", __FUNCTION__, y, z1, z2, z3, z4)
#define LOG_INFO5(y, z1, z2, z3, z4, z5) log_write(_logid, 3, CATMODULE "/" __FUNCTION__, y, z1, z2, z3, z4, z5) #define LOG_INFO5(y, z1, z2, z3, z4, z5) log_write(_logid, 3, CATMODULE "/", __FUNCTION__, y, z1, z2, z3, z4, z5)
#define LOG_DEBUG(y) log_write(_logid, 4, CATMODULE "/" __FUNCTION__, y) #define LOG_DEBUG(y) log_write(_logid, 4, CATMODULE "/", __FUNCTION__, y)
#define LOG_DEBUG2(y, z1, z2) log_write(_logid, 4, CATMODULE "/" __FUNCTION__, y, z1, z2) #define LOG_DEBUG2(y, z1, z2) log_write(_logid, 4, CATMODULE "/", __FUNCTION__, y, z1, z2)
#define LOG_DEBUG5(y, z1, z2, z3, z4, z5) log_write(_logid, 4, CATMODULE "/" __FUNCTION__, y, z1, z2, z3, z4, z5) #define LOG_DEBUG5(y, z1, z2, z3, z4, z5) log_write(_logid, 4, CATMODULE "/", __FUNCTION__, y, z1, z2, z3, z4, z5)
/* thread starting structure */ /* thread starting structure */
typedef struct thread_start_tag { typedef struct thread_start_tag {
@ -256,7 +256,6 @@ long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int
start->thread = thread; start->thread = thread;
start->detached = detached; start->detached = detached;
created = 0; created = 0;
if (pthread_create(&thread->sys_thread, NULL, _start_routine, start) == 0) if (pthread_create(&thread->sys_thread, NULL, _start_routine, start) == 0)
created = 1; created = 1;