-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e377281
commit f3472f1
Showing
2 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (C) 2020 Team Kodi (https://kodi.tv) | ||
* | ||
* SPDX-License-Identifier: GPL-2.0-or-later | ||
* See LICENSE.md for more information. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <kodi/General.h> | ||
|
||
namespace rtmpstream | ||
{ | ||
|
||
inline const char* kodiTranslateLogLevel(const AddonLog logLevel) | ||
{ | ||
switch (logLevel) | ||
{ | ||
case ADDON_LOG_DEBUG: | ||
return "LOG_DEBUG: "; | ||
case ADDON_LOG_INFO: | ||
return "LOG_INFO: "; | ||
case ADDON_LOG_NOTICE: | ||
return "LOG_NOTICE: "; | ||
case ADDON_LOG_WARNING: | ||
return "LOG_WARNING: "; | ||
case ADDON_LOG_ERROR: | ||
return "LOG_ERROR: "; | ||
case ADDON_LOG_SEVERE: | ||
return "LOG_SEVERE: "; | ||
case ADDON_LOG_FATAL: | ||
return "LOG_FATAL: "; | ||
default: | ||
break; | ||
} | ||
return "LOG_UNKNOWN: "; | ||
} | ||
|
||
inline void Log(const AddonLog logLevel, const char* format, ...) | ||
{ | ||
char buffer[16384]; | ||
va_list args; | ||
va_start(args, format); | ||
vsprintf(buffer, format, args); | ||
va_end(args); | ||
|
||
kodi::Log(logLevel, buffer); | ||
#ifdef DEBUG | ||
fprintf(stderr, "%s%s\n", kodiTranslateLogLevel(logLevel), buffer); | ||
#endif | ||
} | ||
|
||
} /* namespace rtmpstream */ |