Skip to content

Commit 1c0c8c5

Browse files
committed
remove – logAtLevel:withMessage:fromStackPos: -- it was confusing and never used
1 parent 7a08896 commit 1c0c8c5

File tree

5 files changed

+41
-141
lines changed

5 files changed

+41
-141
lines changed

LuaSkin/LuaSkin/Skin.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -757,18 +757,5 @@ NSString *specMaskToString(int spec);
757757
*/
758758
- (NSString *)tracebackWithTag:(NSString *)theTag fromStackPos:(int)level ;
759759

760-
/*!
761-
@abstract Log the specified message with at the specified level with the traceback position prepended.
762-
763-
@discussion Logs the specified message, prepended with the lua chunk name and line number at the specified traceback level, for the specified level. The log level and combined message is logged with @link logAtLevel:withMessage: @/link.
764-
765-
@warning This method is primarily for testing and may be removed in a future release.
766-
767-
@param level The message log level as an integer. Predefined levels are defined and used within LuaSkin itself as (in decreasing level of severity) @link LS_LOG_ERROR @/link, @link LS_LOG_WARN @/link, @link LS_LOG_INFO @/link, @link LS_LOG_DEBUG @/link, and @link LS_LOG_VERBOSE @/link.
768-
@param theMessage the message to log
769-
@param pos the lua traceback level to attempt to retrieve the chunk name and line number from
770-
*/
771-
- (void)logAtLevel:(int)level withMessage:(NSString *)theMessage fromStackPos:(int)pos ;
772-
773760
@end
774761

LuaSkin/LuaSkin/Skin.m

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ - (BOOL)registerPushNSHelper:(pushNSHelperFunction)helperFN forClass:(const char
490490
[self logAtLevel:LS_LOG_WARN
491491
withMessage:[NSString stringWithFormat:@"registerPushNSHelper:forClass:%s already defined at %@",
492492
className,
493-
self.registeredNSHelperLocations[@(className)]]
494-
fromStackPos:level] ;
493+
self.registeredNSHelperLocations[@(className)]]] ;
495494
} else {
496495
luaL_where(self.L, level) ;
497496
NSString *locationString = @(lua_tostring(self.L, -1)) ;
@@ -502,8 +501,7 @@ - (BOOL)registerPushNSHelper:(pushNSHelperFunction)helperFN forClass:(const char
502501
}
503502
} else {
504503
[self logAtLevel:LS_LOG_WARN
505-
withMessage:@"registerPushNSHelper:forClass: requires both helperFN and className"
506-
fromStackPos:level] ;
504+
withMessage:@"registerPushNSHelper:forClass: requires both helperFN and className"] ;
507505
}
508506
return allGood ;
509507
}
@@ -572,8 +570,7 @@ - (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(cons
572570
[self logAtLevel:LS_LOG_WARN
573571
withMessage:[NSString stringWithFormat:@"registerLuaObjectHelper:forClass:%s already defined at %@",
574572
className,
575-
self.registeredLuaObjectHelperFunctions[@(className)]]
576-
fromStackPos:level] ;
573+
self.registeredLuaObjectHelperFunctions[@(className)]]] ;
577574
} else {
578575
luaL_where(self.L, level) ;
579576
NSString *locationString = @(lua_tostring(self.L, -1)) ;
@@ -584,8 +581,7 @@ - (BOOL)registerLuaObjectHelper:(luaObjectHelperFunction)helperFN forClass:(cons
584581
}
585582
} else {
586583
[self logAtLevel:LS_LOG_WARN
587-
withMessage:@"registerLuaObjectHelper:forClass: requires both helperFN and className"
588-
fromStackPos:level] ;
584+
withMessage:@"registerLuaObjectHelper:forClass: requires both helperFN and className"] ;
589585
}
590586
return allGood ;
591587
}
@@ -624,8 +620,7 @@ - (NSRect)tableToRectAtIndex:(int)idx {
624620
return NSMakeRect(x, y, w, h) ;
625621
} else {
626622
[self logAtLevel:LS_LOG_WARN
627-
withMessage:[NSString stringWithFormat:@"returning NSZeroRect: can't make NSRect from %s.", lua_typename(self.L, lua_type(self.L, idx))]
628-
fromStackPos:1] ;
623+
withMessage:[NSString stringWithFormat:@"returning NSZeroRect: can't make NSRect from %s.", lua_typename(self.L, lua_type(self.L, idx))]] ;
629624
return NSZeroRect ;
630625
}
631626
}
@@ -639,8 +634,7 @@ - (NSPoint)tableToPointAtIndex:(int)idx {
639634
return NSMakePoint(x, y);
640635
} else {
641636
[self logAtLevel:LS_LOG_WARN
642-
withMessage:[NSString stringWithFormat:@"returning NSZeroPoint: can't make NSPoint from %s.", lua_typename(self.L, lua_type(self.L, idx))]
643-
fromStackPos:1] ;
637+
withMessage:[NSString stringWithFormat:@"returning NSZeroPoint: can't make NSPoint from %s.", lua_typename(self.L, lua_type(self.L, idx))]] ;
644638
return NSZeroPoint ;
645639
}
646640
}
@@ -654,8 +648,7 @@ - (NSSize)tableToSizeAtIndex:(int)idx {
654648
return NSMakeSize(w, h);
655649
} else {
656650
[self logAtLevel:LS_LOG_WARN
657-
withMessage:[NSString stringWithFormat:@"returning NSZeroSize: can't make NSSize from %s.", lua_typename(self.L, lua_type(self.L, idx))]
658-
fromStackPos:1] ;
651+
withMessage:[NSString stringWithFormat:@"returning NSZeroSize: can't make NSSize from %s.", lua_typename(self.L, lua_type(self.L, idx))]] ;
659652
return NSZeroSize ;
660653
}
661654
}
@@ -677,8 +670,7 @@ - (lua_Integer)maxNatIndex:(int)idx {
677670
}
678671
} else {
679672
[self logAtLevel:LS_LOG_ERROR
680-
withMessage:[NSString stringWithFormat:@"table expected (found %s)", lua_typename(self.L, lua_type(self.L, idx))]
681-
fromStackPos:0] ;
673+
withMessage:[NSString stringWithFormat:@"table expected (found %s)", lua_typename(self.L, lua_type(self.L, idx))]] ;
682674
}
683675
return max ;
684676
}
@@ -695,8 +687,7 @@ - (lua_Integer)countNatIndex:(int)idx {
695687
}
696688
} else {
697689
[self logAtLevel:LS_LOG_ERROR
698-
withMessage:[NSString stringWithFormat:@"table expected (found %s)", lua_typename(self.L, lua_type(self.L, idx))]
699-
fromStackPos:0] ;
690+
withMessage:[NSString stringWithFormat:@"table expected (found %s)", lua_typename(self.L, lua_type(self.L, idx))]] ;
700691
}
701692
return max ;
702693
}
@@ -1026,8 +1017,7 @@ - (id)toNSObjectAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObje
10261017
if (seenObject) {
10271018
if ([[seenObject lastObject] isEqualToNumber:@(NO)] && ((options & LS_NSAllowsSelfReference) != LS_NSAllowsSelfReference)) {
10281019
[self logAtLevel:LS_LOG_WARN
1029-
withMessage:@"lua table cannot contain self-references"
1030-
fromStackPos:1] ;
1020+
withMessage:@"lua table cannot contain self-references"] ;
10311021
// return [NSNull null] ;
10321022
return nil ;
10331023
} else {
@@ -1060,8 +1050,7 @@ - (id)toNSObjectAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObje
10601050
} else {
10611051
if (stringOptions != LS_NSNone) {
10621052
[self logAtLevel:LS_LOG_DEBUG
1063-
withMessage:@"only one of LS_NSPreserveLuaStringExactly or LS_NSLuaStringAsDataOnly can be specified: using default behavior"
1064-
fromStackPos:0] ;
1053+
withMessage:@"only one of LS_NSPreserveLuaStringExactly or LS_NSLuaStringAsDataOnly can be specified: using default behavior"] ;
10651054
}
10661055
return [self getValidUTF8AtIndex:idx] ;
10671056
}
@@ -1190,8 +1179,7 @@ - (id)tableAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObjects:(
11901179
} else {
11911180
[self logAtLevel:LS_LOG_ERROR
11921181
withMessage:[NSString stringWithFormat:@"array element (%s) cannot be converted into a proper NSObject",
1193-
luaL_tolstring(self.L, -1, NULL)]
1194-
fromStackPos:1] ;
1182+
luaL_tolstring(self.L, -1, NULL)]] ;
11951183
result = nil ;
11961184
lua_pop(self.L, 2) ; // luaL_tolstring result and lua_geti result
11971185
return nil ;
@@ -1209,8 +1197,7 @@ - (id)tableAtIndex:(int)idx withOptions:(NSUInteger)options alreadySeenObjects:(
12091197
[self logAtLevel:LS_LOG_ERROR
12101198
withMessage:[NSString stringWithFormat:@"dictionary %@ (%s) cannot be converted into a proper NSObject",
12111199
(key) ? @"key" : @"value",
1212-
luaL_tolstring(self.L, (key) ? -2 : lua_gettop(self.L), NULL)]
1213-
fromStackPos:1] ;
1200+
luaL_tolstring(self.L, (key) ? -2 : lua_gettop(self.L), NULL)]] ;
12141201
result = nil ;
12151202
lua_pop(self.L, 3) ; // luaL_tolstring result, lua_next value, and lua_next key
12161203
return nil ;
@@ -1236,17 +1223,6 @@ - (void) logAtLevel:(int)level withMessage:(NSString *)theMessage {
12361223
}
12371224
}
12381225

1239-
// Testing for: chunkname:currentline:theMessage
1240-
- (void) logAtLevel:(int)level withMessage:(NSString *)theMessage fromStackPos:(int)pos {
1241-
luaL_where(self.L, pos) ;
1242-
NSString *locationInfo = @(lua_tostring(self.L, -1)) ;
1243-
lua_pop(self.L, 1) ;
1244-
if (!locationInfo || [locationInfo isEqualToString:@""])
1245-
locationInfo = [NSString stringWithFormat:@"(no lua location info at depth %d)", pos] ;
1246-
1247-
[self logAtLevel:level withMessage:[NSString stringWithFormat:@"%@:%@", locationInfo, theMessage]] ;
1248-
}
1249-
12501226
// shorthand
12511227
- (void)logVerbose:(NSString *)theMessage { [self logAtLevel:LS_LOG_VERBOSE withMessage:theMessage] ; }
12521228
- (void)logDebug:(NSString *)theMessage { [self logAtLevel:LS_LOG_DEBUG withMessage:theMessage] ; }

extensions/application/internal.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,9 +1169,7 @@ static int nsrunningapplication_tolua(lua_State *L, id obj) {
11691169

11701170
if (!new_application(L, [app processIdentifier])) {
11711171
lua_pop(L, 1) ; // removed aborted userdata
1172-
[[LuaSkin shared] logAtLevel:LS_LOG_WARN
1173-
withMessage:[NSString stringWithFormat:@"No Process ID for %@", obj]
1174-
fromStackPos:1] ;
1172+
[[LuaSkin shared] logWarn:[NSString stringWithFormat:@"No Process ID for %@", obj]] ;
11751173
lua_pushnil(L) ;
11761174
}
11771175
return 1 ;

0 commit comments

Comments
 (0)