src/core/log.c (view raw)
1/* Copyright (c) 2013-2016 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#include "log.h"
7
8#include "core/thread.h"
9
10#define MAX_CATEGORY 64
11
12struct mLogger* mLogGetContext(void) {
13 struct mLogger* logger = mCoreThreadLogger();
14 if (logger) {
15 return logger;
16 }
17 return NULL; // TODO
18}
19
20static int _category = 0;
21static const char* _categoryNames[MAX_CATEGORY];
22
23int mLogGenerateCategory(const char* name) {
24 ++_category;
25 if (_category < MAX_CATEGORY) {
26 _categoryNames[_category] = name;
27 }
28 return _category;
29}
30
31const char* mLogCategoryName(int category) {
32 if (category < MAX_CATEGORY) {
33 return _categoryNames[category];
34 }
35 return 0;
36}
37
38mLOG_DEFINE_CATEGORY(STATUS, "Status")