mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-08-07 13:48:30 +02:00
Apply clang format to files
Also add brackets for all scopes at the same time
This commit is contained in:
@@ -32,28 +32,50 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#define _LOGGING_GAMEMODE_H_
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
// Logging helpers
|
||||
#define PLOG_MSG( msg, ... ) printf( msg, ##__VA_ARGS__ )
|
||||
#define SYSLOG_MSG( msg, ... ) syslog( LOG_INFO, msg, ##__VA_ARGS__ )
|
||||
#define LOG_MSG( msg, ... ) do { if( get_use_syslog() ) SYSLOG_MSG( msg, ##__VA_ARGS__ ); else PLOG_MSG( msg, ##__VA_ARGS__ ); } while(0)
|
||||
#define PLOG_MSG(msg, ...) printf(msg, ##__VA_ARGS__)
|
||||
#define SYSLOG_MSG(msg, ...) syslog(LOG_INFO, msg, ##__VA_ARGS__)
|
||||
#define LOG_MSG(msg, ...) \
|
||||
do { \
|
||||
if (get_use_syslog()) { \
|
||||
SYSLOG_MSG(msg, ##__VA_ARGS__); \
|
||||
} else { \
|
||||
PLOG_MSG(msg, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PLOG_ERROR( msg, ... ) fprintf( stderr, msg, ##__VA_ARGS__ )
|
||||
#define SYSLOG_ERROR( msg, ... ) syslog( LOG_ERR, msg, ##__VA_ARGS__ )
|
||||
#define LOG_ERROR( msg, ... ) do { if( get_use_syslog() ) SYSLOG_MSG( msg, ##__VA_ARGS__ ); else PLOG_MSG( msg, ##__VA_ARGS__ ); } while(0)
|
||||
#define PLOG_ERROR(msg, ...) fprintf(stderr, msg, ##__VA_ARGS__)
|
||||
#define SYSLOG_ERROR(msg, ...) syslog(LOG_ERR, msg, ##__VA_ARGS__)
|
||||
#define LOG_ERROR(msg, ...) \
|
||||
do { \
|
||||
if (get_use_syslog()) { \
|
||||
SYSLOG_MSG(msg, ##__VA_ARGS__); \
|
||||
} else { \
|
||||
PLOG_MSG(msg, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// Fatal errors trigger an exit
|
||||
#define FATAL_ERRORNO( msg, ... ) do { LOG_ERROR( msg " (%s)\n", ##__VA_ARGS__, strerror(errno) ); exit(EXIT_FAILURE); } while(0)
|
||||
#define FATAL_ERROR( msg, ... ) do { LOG_ERROR( msg, ##__VA_ARGS__ ); exit(EXIT_FAILURE); } while(0)
|
||||
#define FATAL_ERRORNO(msg, ...) \
|
||||
do { \
|
||||
LOG_ERROR(msg " (%s)\n", ##__VA_ARGS__, strerror(errno)); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} while (0)
|
||||
#define FATAL_ERROR(msg, ...) \
|
||||
do { \
|
||||
LOG_ERROR(msg, ##__VA_ARGS__); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} while (0)
|
||||
|
||||
// Control if we want to use the system logger
|
||||
void set_use_syslog( const char* name );
|
||||
void set_use_syslog(const char *name);
|
||||
bool get_use_syslog();
|
||||
|
||||
#endif //_LOGGING_GAMEMODE_H_
|
||||
|
Reference in New Issue
Block a user