Forked from juliengrimault/FileFunctionLevelFormatter.h
Last active
December 25, 2015 13:19
-
-
Save chourobin/6983264 to your computer and use it in GitHub Desktop.
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
// | |
// FileFunctionLevelFormatter.h | |
// Stylist | |
// | |
// Created by Robin Chou on 10/23/14. | |
// Copyright (c) 2014 Voila. All rights reserved. | |
// | |
#import "DDLog.h" | |
@interface FileFunctionLevelFormatter : NSObject <DDLogFormatter> | |
@end |
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
// | |
// FileFunctionLevelFormatter.m | |
// Stylist | |
// | |
// Created by Robin Chou on 10/23/14. | |
// Copyright (c) 2014 Voila. All rights reserved. | |
// | |
#import "FileFunctionLevelFormatter.h" | |
@implementation FileFunctionLevelFormatter | |
- (NSString*)formatLogMessage:(DDLogMessage *)logMessage | |
{ | |
NSString* logLevel = nil; | |
switch (logMessage->logLevel) { | |
case LOG_FLAG_ERROR : logLevel = @"E"; break; | |
case LOG_FLAG_WARN : logLevel = @"W"; break; | |
case LOG_FLAG_INFO : logLevel = @"I"; break; | |
default : logLevel = @"V"; break; | |
} | |
return [NSString stringWithFormat:@"[%@][%@ %@][Line %d] %@", | |
logLevel, | |
logMessage.fileName, | |
logMessage.methodName, | |
logMessage->lineNumber, | |
logMessage->logMsg]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment