2 * Copyright 2019-2020 Iwo 'Outfrost' Bujkiewicz
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
14 LogLevel logLevel = LOGLEVEL_DEBUG;
18 void logMessage(LogLevel msgLevel, const char* func, const char* message, ...) {
19 if (msgLevel > logLevel) {
23 const char* msgLevelString;
26 msgLevelString = "ERROR ";
28 case LOGLEVEL_WARNING:
29 msgLevelString = "WARNING ";
35 msgLevelString = "DEBUG ";
38 msgLevelString = "(invalid message level) ";
43 va_start(args, message);
45 fprintf(stderr, "%s %s:: ", func, msgLevelString);
46 vfprintf(stderr, message, args);