-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement log as own module for better style
- Loading branch information
Showing
6 changed files
with
80 additions
and
47 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
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,38 @@ | ||
/** | ||
* Copyright (c) 2016 harlequin | ||
* https://github.com/harlequin/samygo-plugin-dvbapi | ||
* | ||
* This file is part of samygo-plugin-dvbapi. | ||
* | ||
* samygo-plugin-dvbapi is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#include <stdio.h> | ||
#include <stdarg.h> | ||
#include "log.h" | ||
|
||
void LOG(const char *fmt, ...) { | ||
#ifdef LOG_FILE | ||
va_list ap; | ||
|
||
FILE *f = fopen(LOG_FILE, "a+"); | ||
if(f) { | ||
va_start(ap, fmt); | ||
vfprintf(f, fmt, ap); | ||
va_end(ap); | ||
|
||
fflush(f); | ||
fclose(f); | ||
} | ||
#endif | ||
} |
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,33 @@ | ||
/** | ||
* Copyright (c) 2016 harlequin | ||
* https://github.com/harlequin/samygo-plugin-dvbapi | ||
* | ||
* This file is part of samygo-plugin-dvbapi. | ||
* | ||
* samygo-plugin-dvbapi is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#ifndef LOG_H_ | ||
#define LOG_H_ | ||
|
||
#define LIB_NAME "dvbapi" | ||
#define LIB_VERSION "v0.0.1" | ||
#define LIB_TV_MODELS "D (MIPS/MSTAR)" | ||
#define INFO_VERSION "samygo-plugin-dvbapi " LIB_VERSION " / MODEL " LIB_TV_MODELS | ||
#define LOG_FILE "/dtv/"LIB_NAME".log" | ||
void LOG(const char *fmt, ...); | ||
#define log(...) LOG("["LIB_NAME"] "__VA_ARGS__); | ||
#define logh(fmt,...) LOG("["LIB_NAME"] %s, "fmt,__func__+2,__VA_ARGS__) | ||
#define logf(fmt,...) LOG("["LIB_NAME"] %s, "fmt,__func__,__VA_ARGS__) | ||
|
||
#endif /* LOG_H_ */ |
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