OLD | NEW |
1 // | 1 // |
2 // GTMLogger.m | 2 // GTMLogger.m |
3 // | 3 // |
4 // Copyright 2007-2008 Google Inc. | 4 // Copyright 2007-2008 Google Inc. |
5 // | 5 // |
6 // Licensed under the Apache License, Version 2.0 (the "License"); you may not | 6 // Licensed under the Apache License, Version 2.0 (the "License"); you may not |
7 // use this file except in compliance with the License. You may obtain a copy | 7 // use this file except in compliance with the License. You may obtain a copy |
8 // of the License at | 8 // of the License at |
9 // | 9 // |
10 // http://www.apache.org/licenses/LICENSE-2.0 | 10 // http://www.apache.org/licenses/LICENSE-2.0 |
11 // | 11 // |
12 // Unless required by applicable law or agreed to in writing, software | 12 // Unless required by applicable law or agreed to in writing, software |
13 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | 13 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
14 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | 14 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
15 // License for the specific language governing permissions and limitations unde
r | 15 // License for the specific language governing permissions and limitations unde
r |
16 // the License. | 16 // the License. |
17 // | 17 // |
18 | 18 |
19 #import "GTMLogger.h" | 19 #import "GTMLogger.h" |
20 #import "GTMGarbageCollection.h" | |
21 #import <fcntl.h> | 20 #import <fcntl.h> |
22 #import <unistd.h> | 21 #import <unistd.h> |
23 #import <stdlib.h> | 22 #import <stdlib.h> |
24 #import <pthread.h> | 23 #import <pthread.h> |
25 | 24 |
26 | 25 |
27 #if !defined(__clang__) && (__GNUC__*10+__GNUC_MINOR__ >= 42) | 26 #if !defined(__clang__) && (__GNUC__*10+__GNUC_MINOR__ >= 42) |
28 // Some versions of GCC (4.2 and below AFAIK) aren't great about supporting | 27 // Some versions of GCC (4.2 and below AFAIK) aren't great about supporting |
29 // -Wmissing-format-attribute | 28 // -Wmissing-format-attribute |
30 // when the function is anything more complex than foo(NSString *fmt, ...). | 29 // when the function is anything more complex than foo(NSString *fmt, ...). |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 return NO; | 498 return NO; |
500 } | 499 } |
501 } | 500 } |
502 return [[NSUserDefaults standardUserDefaults] boolForKey:kVerboseLoggingKey]; | 501 return [[NSUserDefaults standardUserDefaults] boolForKey:kVerboseLoggingKey]; |
503 } | 502 } |
504 // COV_NF_END | 503 // COV_NF_END |
505 | 504 |
506 // In DEBUG builds, log everything. If we're not in a debug build we'll assume | 505 // In DEBUG builds, log everything. If we're not in a debug build we'll assume |
507 // that we're in a Release build. | 506 // that we're in a Release build. |
508 - (BOOL)filterAllowsMessage:(NSString *)msg level:(GTMLoggerLevel)level { | 507 - (BOOL)filterAllowsMessage:(NSString *)msg level:(GTMLoggerLevel)level { |
509 #if DEBUG | 508 #if defined(DEBUG) && DEBUG |
510 return YES; | 509 return YES; |
511 #endif | 510 #endif |
512 | 511 |
513 BOOL allow = YES; | 512 BOOL allow = YES; |
514 | 513 |
515 switch (level) { | 514 switch (level) { |
516 case kGTMLoggerLevelDebug: | 515 case kGTMLoggerLevelDebug: |
517 allow = NO; | 516 allow = NO; |
518 break; | 517 break; |
519 case kGTMLoggerLevelInfo: | 518 case kGTMLoggerLevelInfo: |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 NSMakeRange(kGTMLoggerLevelUnknown, level + 1)]]; | 602 NSMakeRange(kGTMLoggerLevelUnknown, level + 1)]]; |
604 } | 603 } |
605 | 604 |
606 @end // GTMLogMaximumLevelFilter | 605 @end // GTMLogMaximumLevelFilter |
607 | 606 |
608 #if !defined(__clang__) && (__GNUC__*10+__GNUC_MINOR__ >= 42) | 607 #if !defined(__clang__) && (__GNUC__*10+__GNUC_MINOR__ >= 42) |
609 // See comment at top of file. | 608 // See comment at top of file. |
610 #pragma GCC diagnostic error "-Wmissing-format-attribute" | 609 #pragma GCC diagnostic error "-Wmissing-format-attribute" |
611 #endif // !__clang__ | 610 #endif // !__clang__ |
612 | 611 |
OLD | NEW |