Commit 49e028cd authored by Michael Smith's avatar Michael Smith

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
parent 3e60ee06
......@@ -160,7 +160,8 @@ void log_shutdown()
_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" };
char tyme[128];
......@@ -181,7 +182,7 @@ void log_write(int log_id, int priority, const char *cat, const char *fmt, ...)
now = time(NULL);
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);
......
......@@ -20,7 +20,8 @@ void log_reopen(int log_id);
void log_close(int log_id);
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, ...);
#endif /* __LOG_H__ */
......@@ -47,22 +47,22 @@
#endif
#define CATMODULE "thread"
#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_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_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_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_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_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_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_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_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_INFO5(y, z1, z2, z3, z4, z5) log_write(_logid, 3, CATMODULE "/" __FUNCTION__, y, z1, z2, z3, z4, z5)
#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_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_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_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_DEBUG5(y, z1, z2, z3, z4, z5) log_write(_logid, 4, CATMODULE "/", __FUNCTION__, y, z1, z2, z3, z4, z5)
/* thread starting structure */
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->detached = detached;
created = 0;
if (pthread_create(&thread->sys_thread, NULL, _start_routine, start) == 0)
created = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment