Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (75 sloc) 4.72 KB
/*
* This file is part of the TVShows 2 ("Phoenix") source code.
* http://github.com/mattprice/TVShows/
*
* TVShows 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.
*
* You should have received a copy of the GNU General Public License
* along with TVShows. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import "LCLLogFile.h"
#endif
// TVShows uses parts of LibComponentLogging <http://0xc0.de/LibComponentLogging>.
// Check out the full library for even more awesome power.
#if HELPER_APP
#define LogIdentifier "[Downloader]"
#else
#define LogIdentifier "[Main App]"
#endif
// CRITICAL
#define LogCritical(...) [LCLLogFile logWithIdentifier: LogIdentifier \
level: 1 \
path: __FILE__ \
line: __LINE__ \
function: __PRETTY_FUNCTION__ \
format: [NSString stringWithFormat:__VA_ARGS__]];
// ERROR
#define LogError(...) [LCLLogFile logWithIdentifier: LogIdentifier \
level: 2 \
path: __FILE__ \
line: __LINE__ \
function: __PRETTY_FUNCTION__ \
format: [NSString stringWithFormat:__VA_ARGS__]];
// WARNING
#define LogWarning(...) [LCLLogFile logWithIdentifier: LogIdentifier \
level: 3 \
path: __FILE__ \
line: __LINE__ \
function: __PRETTY_FUNCTION__ \
format: [NSString stringWithFormat:__VA_ARGS__]];
// INFO
#define LogInfo(...) [LCLLogFile logWithIdentifier: LogIdentifier \
level: 4 \
path: __FILE__ \
line: __LINE__ \
function: __PRETTY_FUNCTION__ \
format: [NSString stringWithFormat:__VA_ARGS__]];
#ifdef DEBUG
// DEBUG
#define LogDebug(...) [LCLLogFile logWithIdentifier: LogIdentifier \
level: 5 \
path: __FILE__ \
line: __LINE__ \
function: __PRETTY_FUNCTION__ \
format: [NSString stringWithFormat:__VA_ARGS__]];
// TRACE
#define LogTrace(...) [LCLLogFile logWithIdentifier: LogIdentifier \
level: 6 \
path: __FILE__ \
line: __LINE__ \
function: __PRETTY_FUNCTION__ \
format: [NSString stringWithFormat:__VA_ARGS__]];
#else
#define LogDebug(...) do { } while (0)
#define LogTrace(...) do { } while (0)
#endif
// I'm sure that this is entirely unorthodox, but let's make a custom
// localiztion macro to save us from having to type all this crap in.
#define TSLocalizeString(...) NSLocalizedStringFromTableInBundle(__VA_ARGS__, @"Localizable", [NSBundle bundleForClass:[self class]], nil)