forked from Telodendria/Telodendria
Fix references to old LOG_ constants
This commit is contained in:
parent
399939654a
commit
70bdf81df7
7 changed files with 84 additions and 94 deletions
2
TODO.txt
2
TODO.txt
|
@ -25,7 +25,7 @@ Due: January 1, 2023
|
|||
[ ] Document send-patch
|
||||
[~] Convert documentation to man pages
|
||||
[~] Internal API docs
|
||||
[~] Array
|
||||
[x] Array
|
||||
[x] Base64
|
||||
[ ] CanonicalJson
|
||||
[ ] Config
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.Dd $Mdocdate: September 30 2022 $
|
||||
.Dd $Mdocdate: November 24 2022 $
|
||||
.Dt ARRAY 3
|
||||
.Os Telodendria Project
|
||||
.Sh NAME
|
||||
|
@ -24,6 +24,10 @@
|
|||
.Fn ArrayDelete "Array *" "size_t"
|
||||
.Ft void
|
||||
.Fn ArraySort "Array *" "int (*) (void *, void *)"
|
||||
.Ft Array *
|
||||
.Fn ArrayFromVarArgs "size_t" "va_list"
|
||||
.Ft Array *
|
||||
.Fn ArrayDuplicate "Array *"
|
||||
.Sh DESCRIPTION
|
||||
These functions implement a simple array data structure that
|
||||
is automatically resized as necessary when new values are added.
|
||||
|
@ -85,9 +89,23 @@ the opposite: the second element should appear after the first in the array.
|
|||
.Pp
|
||||
.Fn ArrayGet
|
||||
is used to get the element at the specified index.
|
||||
.Pp
|
||||
.Fn ArrayFromVarArgs
|
||||
is used to convert a variadic arguments list into an Array. In many
|
||||
cases, the Array API is much easier to work with than
|
||||
.Fn va_arg
|
||||
and friends.
|
||||
.Pp
|
||||
.Fn ArrayDuplicate
|
||||
duplicates an existing array. Note that Arrays only hold
|
||||
pointers to data, not the data itself, so the duplicated array will
|
||||
point to the same places in memory as the original array.
|
||||
.Sh RETURN VALUES
|
||||
.Fn ArrayCreate
|
||||
returns a pointer on the heap to a newly allocated array structure, or
|
||||
.Fn ArrayCreate ,
|
||||
.Fn ArrayFromVarArgs ,
|
||||
and
|
||||
.Fn ArrayDuplicate
|
||||
return a pointer on the heap to a newly allocated array structure, or
|
||||
.Dv NULL
|
||||
if the allocation fails.
|
||||
.Pp
|
||||
|
|
12
src/Log.c
12
src/Log.c
|
@ -59,7 +59,7 @@ LogConfigCreate(void)
|
|||
|
||||
memset(config, 0, sizeof(LogConfig));
|
||||
|
||||
LogConfigLevelSet(config, LOG_MESSAGE);
|
||||
LogConfigLevelSet(config, LOG_INFO);
|
||||
LogConfigIndentSet(config, 0);
|
||||
LogConfigOutputSet(config, NULL); /* Will set to stdout */
|
||||
LogConfigFlagSet(config, LOG_FLAG_COLOR);
|
||||
|
@ -154,9 +154,9 @@ LogConfigLevelSet(LogConfig * config, int level)
|
|||
|
||||
switch (level)
|
||||
{
|
||||
case LOG_ERROR:
|
||||
case LOG_ERR:
|
||||
case LOG_WARNING:
|
||||
case LOG_MESSAGE:
|
||||
case LOG_INFO:
|
||||
case LOG_DEBUG:
|
||||
config->level = level;
|
||||
default:
|
||||
|
@ -311,16 +311,16 @@ Log(LogConfig * config, int level, const char *msg,...)
|
|||
case LOG_CRIT:
|
||||
indicator = 'X';
|
||||
break;
|
||||
case LOG_ERROR:
|
||||
case LOG_ERR:
|
||||
indicator = 'x';
|
||||
break;
|
||||
case LOG_WARNING:
|
||||
indicator = '!';
|
||||
break;
|
||||
case LOG_TASK:
|
||||
case LOG_NOTICE:
|
||||
indicator = '~';
|
||||
break;
|
||||
case LOG_MESSAGE:
|
||||
case LOG_INFO:
|
||||
indicator = '>';
|
||||
break;
|
||||
case LOG_DEBUG:
|
||||
|
|
|
@ -39,6 +39,7 @@ MatrixHttpHandler(HttpServerContext * context, void *argp)
|
|||
MatrixHttpHandlerArgs *args = (MatrixHttpHandlerArgs *) argp;
|
||||
|
||||
LogConfig *lc = args->lc;
|
||||
Db *db = args->db;
|
||||
|
||||
HashMap *requestHeaders = HttpRequestHeaders(context);
|
||||
FILE *stream;
|
||||
|
@ -54,7 +55,7 @@ MatrixHttpHandler(HttpServerContext * context, void *argp)
|
|||
|
||||
requestPath = HttpRequestPath(context);
|
||||
|
||||
Log(lc, LOG_MESSAGE, "%s %s",
|
||||
Log(lc, LOG_INFO, "%s %s",
|
||||
HttpRequestMethodToString(HttpRequestMethodGet(context)),
|
||||
requestPath);
|
||||
|
||||
|
|
|
@ -104,23 +104,23 @@ typedef enum ArgFlag
|
|||
static void
|
||||
TelodendriaPrintHeader(LogConfig * lc)
|
||||
{
|
||||
Log(lc, LOG_MESSAGE,
|
||||
Log(lc, LOG_INFO,
|
||||
" _____ _ _ _ _");
|
||||
Log(lc, LOG_MESSAGE,
|
||||
Log(lc, LOG_INFO,
|
||||
"|_ _|__| | ___ __| | ___ _ __ __| |_ __(_) __ _");
|
||||
Log(lc, LOG_MESSAGE,
|
||||
Log(lc, LOG_INFO,
|
||||
" | |/ _ \\ |/ _ \\ / _` |/ _ \\ '_ \\ / _` | '__| |/ _` |");
|
||||
Log(lc, LOG_MESSAGE,
|
||||
Log(lc, LOG_INFO,
|
||||
" | | __/ | (_) | (_| | __/ | | | (_| | | | | (_| |");
|
||||
Log(lc, LOG_MESSAGE,
|
||||
Log(lc, LOG_INFO,
|
||||
" |_|\\___|_|\\___/ \\__,_|\\___|_| |_|\\__,_|_| |_|\\__,_|");
|
||||
Log(lc, LOG_MESSAGE, "Telodendria v" TELODENDRIA_VERSION);
|
||||
Log(lc, LOG_MESSAGE, "");
|
||||
Log(lc, LOG_MESSAGE,
|
||||
Log(lc, LOG_INFO, "Telodendria v" TELODENDRIA_VERSION);
|
||||
Log(lc, LOG_INFO, "");
|
||||
Log(lc, LOG_INFO,
|
||||
"Copyright (C) 2022 Jordan Bancino <@jordan:bancino.net>");
|
||||
Log(lc, LOG_MESSAGE,
|
||||
Log(lc, LOG_INFO,
|
||||
"Documentation/Support: https://telodendria.io");
|
||||
Log(lc, LOG_MESSAGE, "");
|
||||
Log(lc, LOG_INFO, "");
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -170,7 +170,7 @@ main(int argc, char **argv)
|
|||
|
||||
if (pledge("stdio rpath wpath cpath flock inet dns getpw id unveil", NULL) != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Pledge failed: %s", strerror(errno));
|
||||
Log(lc, LOG_ERR, "Pledge failed: %s", strerror(errno));
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ main(int argc, char **argv)
|
|||
|
||||
if (!configArg)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "No configuration file specified.");
|
||||
Log(lc, LOG_ERR, "No configuration file specified.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ main(int argc, char **argv)
|
|||
#ifdef __OpenBSD__
|
||||
if (unveil(configArg, "r") != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to unveil() configuration file '%s' for reading.", configArg);
|
||||
Log(lc, LOG_ERR, "Unable to unveil() configuration file '%s' for reading.", configArg);
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -229,18 +229,18 @@ main(int argc, char **argv)
|
|||
configFile = fopen(configArg, "r");
|
||||
if (!configFile)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to open configuration file '%s' for reading.", configArg);
|
||||
Log(lc, LOG_ERR, "Unable to open configuration file '%s' for reading.", configArg);
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
|
||||
Log(lc, LOG_TASK, "Processing configuration file '%s'.", configArg);
|
||||
Log(lc, LOG_NOTICE, "Processing configuration file '%s'.", configArg);
|
||||
|
||||
configParseResult = ConfigParse(configFile);
|
||||
if (!ConfigParseResultOk(configParseResult))
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Syntax error on line %d.",
|
||||
Log(lc, LOG_ERR, "Syntax error on line %d.",
|
||||
ConfigParseResultLineNumber(configParseResult));
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
|
@ -262,14 +262,14 @@ main(int argc, char **argv)
|
|||
|
||||
if (flags & ARG_CONFIGTEST)
|
||||
{
|
||||
Log(lc, LOG_MESSAGE, "Configuration is OK.");
|
||||
Log(lc, LOG_INFO, "Configuration is OK.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
if (unveil(tConfig->dataDir, "rwc") != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unveil of data directory failed: %s", strerror(errno));
|
||||
Log(lc, LOG_ERR, "Unveil of data directory failed: %s", strerror(errno));
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ main(int argc, char **argv)
|
|||
|
||||
if (chdir(tConfig->dataDir) != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to change into data directory: %s.", strerror(errno));
|
||||
Log(lc, LOG_ERR, "Unable to change into data directory: %s.", strerror(errno));
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -308,12 +308,12 @@ main(int argc, char **argv)
|
|||
|
||||
if (!logFile)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to open log file for appending.");
|
||||
Log(lc, LOG_ERR, "Unable to open log file for appending.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
Log(lc, LOG_MESSAGE, "Logging to the log file. Check there for all future messages.");
|
||||
Log(lc, LOG_INFO, "Logging to the log file. Check there for all future messages.");
|
||||
LogConfigOutputSet(lc, logFile);
|
||||
}
|
||||
else if (tConfig->flags & TELODENDRIA_LOG_STDOUT)
|
||||
|
@ -322,7 +322,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
else if (tConfig->flags & TELODENDRIA_LOG_SYSLOG)
|
||||
{
|
||||
Log(lc, LOG_MESSAGE, "Logging to the syslog. Check there for all future messages.");
|
||||
Log(lc, LOG_INFO, "Logging to the syslog. Check there for all future messages.");
|
||||
LogConfigFlagSet(lc, LOG_FLAG_SYSLOG);
|
||||
|
||||
openlog("telodendria", LOG_PID | LOG_NDELAY, LOG_DAEMON);
|
||||
|
@ -332,8 +332,8 @@ main(int argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unknown logging method in flags: '%d'", tConfig->flags);
|
||||
Log(lc, LOG_ERROR, "This is a programmer error; please report it.");
|
||||
Log(lc, LOG_ERR, "Unknown logging method in flags: '%d'", tConfig->flags);
|
||||
Log(lc, LOG_ERR, "This is a programmer error; please report it.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ main(int argc, char **argv)
|
|||
MatrixHttpHandler, &matrixArgs);
|
||||
if (!httpServer)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to create HTTP server on port %d: %s",
|
||||
Log(lc, LOG_ERR, "Unable to create HTTP server on port %d: %s",
|
||||
tConfig->listenPort, strerror(errno));
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
|
@ -376,7 +376,7 @@ main(int argc, char **argv)
|
|||
|
||||
if (!userInfo || !groupInfo)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to locate the user/group specified in the configuration.");
|
||||
Log(lc, LOG_ERR, "Unable to locate the user/group specified in the configuration.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ main(int argc, char **argv)
|
|||
{
|
||||
if (setgid(groupInfo->gr_gid) != 0 || setuid(userInfo->pw_uid) != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to set process uid/gid.");
|
||||
Log(lc, LOG_ERR, "Unable to set process uid/gid.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -474,21 +474,21 @@ main(int argc, char **argv)
|
|||
|
||||
if (!matrixArgs.db)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to open data directory as a database.");
|
||||
Log(lc, LOG_ERR, "Unable to open data directory as a database.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
Log(lc, LOG_TASK, "Starting server...");
|
||||
Log(lc, LOG_NOTICE, "Starting server...");
|
||||
|
||||
if (!HttpServerStart(httpServer))
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to start HTTP server.");
|
||||
Log(lc, LOG_ERR, "Unable to start HTTP server.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
Log(lc, LOG_MESSAGE, "Listening on port: %d", tConfig->listenPort);
|
||||
Log(lc, LOG_INFO, "Listening on port: %d", tConfig->listenPort);
|
||||
|
||||
sigAction.sa_handler = TelodendriaSignalHandler;
|
||||
sigfillset(&sigAction.sa_mask);
|
||||
|
@ -496,7 +496,7 @@ main(int argc, char **argv)
|
|||
|
||||
if (sigaction(SIGINT, &sigAction, NULL) < 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unable to install signal handler.");
|
||||
Log(lc, LOG_ERR, "Unable to install signal handler.");
|
||||
exit = EXIT_FAILURE;
|
||||
goto finish;
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ main(int argc, char **argv)
|
|||
HttpServerJoin(httpServer);
|
||||
|
||||
finish:
|
||||
Log(lc, LOG_TASK, "Shutting down...");
|
||||
Log(lc, LOG_NOTICE, "Shutting down...");
|
||||
if (httpServer)
|
||||
{
|
||||
HttpServerFree(httpServer);
|
||||
|
|
|
@ -50,19 +50,19 @@ IsInteger(char *str)
|
|||
#define GET_DIRECTIVE(name) \
|
||||
directive = (ConfigDirective *) HashMapGet(config, name); \
|
||||
if (!directive) { \
|
||||
Log(lc, LOG_ERROR, "Missing required configuration directive: '%s'.", name); \
|
||||
Log(lc, LOG_ERR, "Missing required configuration directive: '%s'.", name); \
|
||||
goto error; \
|
||||
} \
|
||||
children = ConfigChildrenGet(directive); \
|
||||
value = ConfigValuesGet(directive); \
|
||||
|
||||
#define ASSERT_NO_CHILDREN(name) if (children) { \
|
||||
Log(lc, LOG_ERROR, "Unexpected child values in directive: '%s'.", name); \
|
||||
Log(lc, LOG_ERR, "Unexpected child values in directive: '%s'.", name); \
|
||||
goto error; \
|
||||
}
|
||||
|
||||
#define ASSERT_VALUES(name, expected) if (ArraySize(value) != expected) { \
|
||||
Log(lc, LOG_ERROR, \
|
||||
Log(lc, LOG_ERR, \
|
||||
"Wrong value count in directive '%s': got '%d', but expected '%d'.", \
|
||||
name, ArraySize(value), expected); \
|
||||
goto error; \
|
||||
|
@ -108,7 +108,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
tConfig->listenPort = (unsigned short) atoi(ArrayGet(value, 0));
|
||||
if (!tConfig->listenPort)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Expected numeric value for listen port, got '%s'.", ArrayGet(value, 1));
|
||||
Log(lc, LOG_ERR, "Expected numeric value for listen port, got '%s'.", ArrayGet(value, 1));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
tConfig->baseUrl = Malloc(strlen(tConfig->serverName) + 10);
|
||||
if (!tConfig->baseUrl)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Error allocating memory for default config value 'base-url'.");
|
||||
Log(lc, LOG_ERR, "Error allocating memory for default config value 'base-url'.");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
COPY_VALUE(tConfig->gid, 1);
|
||||
break;
|
||||
default:
|
||||
Log(lc, LOG_ERROR,
|
||||
Log(lc, LOG_ERR,
|
||||
"Wrong value count in directive 'id': got '%d', but expected 1 or 2.",
|
||||
ArraySize(value));
|
||||
goto error;
|
||||
|
@ -204,13 +204,13 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
tConfig->threads = atoi(ArrayGet(value, 0));
|
||||
if (!tConfig->threads)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "threads must be greater than zero");
|
||||
Log(lc, LOG_ERR, "threads must be greater than zero");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lc, LOG_ERROR,
|
||||
Log(lc, LOG_ERR,
|
||||
"Expected integer for directive 'threads', "
|
||||
"but got '%s'.", ArrayGet(value, 0));
|
||||
goto error;
|
||||
|
@ -231,13 +231,13 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
tConfig->maxConnections = atoi(ArrayGet(value, 0));
|
||||
if (!tConfig->maxConnections)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "max-connections must be greater than zero.");
|
||||
Log(lc, LOG_ERR, "max-connections must be greater than zero.");
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Expected integer for max-connections, got '%s'", ArrayGet(value, 0));
|
||||
Log(lc, LOG_ERR, "Expected integer for max-connections, got '%s'", ArrayGet(value, 0));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
}
|
||||
else if (strcmp(ArrayGet(value, 0), "false") != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR,
|
||||
Log(lc, LOG_ERR,
|
||||
"Expected boolean value for directive 'federation', "
|
||||
"but got '%s'.", ArrayGet(value, 0));
|
||||
goto error;
|
||||
|
@ -272,7 +272,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
}
|
||||
else if (strcmp(ArrayGet(value, 0), "false") != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR,
|
||||
Log(lc, LOG_ERR,
|
||||
"Expected boolean value for directive 'registration', "
|
||||
"but got '%s'.", ArrayGet(value, 0));
|
||||
goto error;
|
||||
|
@ -293,14 +293,14 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
size = ArraySize(ConfigValuesGet(cDirective));
|
||||
if (size > 1)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Expected 1 value for log.level, got %d.", size);
|
||||
Log(lc, LOG_ERR, "Expected 1 value for log.level, got %d.", size);
|
||||
goto error;
|
||||
}
|
||||
|
||||
cVal = ArrayGet(ConfigValuesGet(cDirective), 0);
|
||||
if (strcmp(cVal, "message") == 0)
|
||||
{
|
||||
tConfig->logLevel = LOG_MESSAGE;
|
||||
tConfig->logLevel = LOG_INFO;
|
||||
}
|
||||
else if (strcmp(cVal, "debug") == 0)
|
||||
{
|
||||
|
@ -308,7 +308,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
}
|
||||
else if (strcmp(cVal, "task") == 0)
|
||||
{
|
||||
tConfig->logLevel = LOG_TASK;
|
||||
tConfig->logLevel = LOG_NOTICE;
|
||||
}
|
||||
else if (strcmp(cVal, "warning") == 0)
|
||||
{
|
||||
|
@ -316,11 +316,11 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
}
|
||||
else if (strcmp(cVal, "error") == 0)
|
||||
{
|
||||
tConfig->logLevel = LOG_ERROR;
|
||||
tConfig->logLevel = LOG_ERR;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Invalid value for log.level: '%s'.", cVal);
|
||||
Log(lc, LOG_ERR, "Invalid value for log.level: '%s'.", cVal);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
size = ArraySize(ConfigValuesGet(cDirective));
|
||||
if (size > 1)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Expected 1 value for log.level, got %d.", size);
|
||||
Log(lc, LOG_ERR, "Expected 1 value for log.level, got %d.", size);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -353,7 +353,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
size = ArraySize(ConfigValuesGet(cDirective));
|
||||
if (size > 1)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Expected 1 value for log.level, got %d.", size);
|
||||
Log(lc, LOG_ERR, "Expected 1 value for log.level, got %d.", size);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
}
|
||||
else if (strcmp(cVal, "false") != 0)
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Expected boolean value for log.color, got '%s'.", cVal);
|
||||
Log(lc, LOG_ERR, "Expected boolean value for log.color, got '%s'.", cVal);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ TelodendriaConfigParse(HashMap * config, LogConfig * lc)
|
|||
}
|
||||
else
|
||||
{
|
||||
Log(lc, LOG_ERROR, "Unknown log value '%s', expected 'stdout', 'file', or 'syslog'.",
|
||||
Log(lc, LOG_ERR, "Unknown log value '%s', expected 'stdout', 'file', or 'syslog'.",
|
||||
ArrayGet(value, 0));
|
||||
goto error;
|
||||
}
|
||||
|
|
|
@ -22,23 +22,6 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Log.h: A heavily-modified version of Shlog, a simple C logging
|
||||
* facility that allows for colorful output, timestamps, and custom
|
||||
* log levels. This library differs from Shlog in that the naming
|
||||
* conventions have been updated to be consistent with Telodendria.
|
||||
*
|
||||
* Shlog was originally a learning project. It worked well, however,
|
||||
* and produced elegant logging output, so it was chosen to be the
|
||||
* main logging mechanism of Telodendria. The original Shlog project
|
||||
* is now dead; Shlog lives on now only as Telodendria's logging
|
||||
* mechanism.
|
||||
*
|
||||
* In the name of simplicity and portability, I opted to use an
|
||||
* in-house logging system instead of syslog(), or other system logging
|
||||
* mechanisms. However, this API could easily be patched to allow
|
||||
* logging via other mechanisms that support the same features.
|
||||
*/
|
||||
#ifndef TELODENDRIA_LOG_H
|
||||
#define TELODENDRIA_LOG_H
|
||||
|
||||
|
@ -46,18 +29,6 @@
|
|||
#include <stddef.h>
|
||||
#include <syslog.h>
|
||||
|
||||
/*
|
||||
* I used to define all my own constants, but now I use
|
||||
* those defined in syslog.h. Instead of replacing all the
|
||||
* references, I just map the old names to the new ones. If
|
||||
* you're ever bored one day, you can remove these, and then
|
||||
* go fix all the compiler errors that arise. Should be pretty
|
||||
* easy, just mind numbing.
|
||||
*/
|
||||
#define LOG_ERROR LOG_ERR
|
||||
#define LOG_TASK LOG_NOTICE
|
||||
#define LOG_MESSAGE LOG_INFO
|
||||
|
||||
/*
|
||||
* The possible flags that can be applied to alter the behavior of
|
||||
* the logger.
|
||||
|
|
Loading…
Reference in a new issue