]> granicus.if.org Git - transmission/commitdiff
update Mac code for logging changes in r13868
authorMitchell Livingston <livings124@transmissionbt.com>
Sat, 26 Jan 2013 19:17:58 +0000 (19:17 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sat, 26 Jan 2013 19:17:58 +0000 (19:17 +0000)
Transmission.xcodeproj/project.pbxproj
macosx/Controller.m
macosx/MessageWindowController.m
macosx/Torrent.m

index 2c3dcf854fcb2e472accd4c509dddd6ad1adfd2f..2e8a99004874774c7856b9bbf3daa7fa66b795a1 100644 (file)
                A2AB76EA15D8130B009EFC95 /* libcurl.4.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A2290D2D1442B23200B95A09 /* libcurl.4.dylib */; };
                A2AB883E16A399A6008FAD50 /* VDKQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AB883C16A399A6008FAD50 /* VDKQueue.m */; };
                A2AF1C390A3D0F6200F1575D /* FileOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = A2AF1C370A3D0F6200F1575D /* FileOutlineView.m */; };
+               A2AF23C816B44FA0003BC59E /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = A2AF23C616B44FA0003BC59E /* log.c */; };
+               A2AF23C916B44FA0003BC59E /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = A2AF23C716B44FA0003BC59E /* log.h */; };
                A2B3FB460E5901E700FF78FB /* cli.c in Sources */ = {isa = PBXBuildFile; fileRef = A2B3FB450E5901E700FF78FB /* cli.c */; };
                A2B3FB4C0E59023000FF78FB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
                A2B3FB530E59027100FF78FB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
                A2AC81D60D987E2D00A2878C /* nl */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = nl; path = macosx/nl.lproj/AddWindow.xib; sourceTree = "<group>"; };
                A2AF1C360A3D0F6200F1575D /* FileOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FileOutlineView.h; path = macosx/FileOutlineView.h; sourceTree = "<group>"; };
                A2AF1C370A3D0F6200F1575D /* FileOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = FileOutlineView.m; path = macosx/FileOutlineView.m; sourceTree = "<group>"; };
+               A2AF23C616B44FA0003BC59E /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = log.c; path = libtransmission/log.c; sourceTree = "<group>"; };
+               A2AF23C716B44FA0003BC59E /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = log.h; path = libtransmission/log.h; sourceTree = "<group>"; };
                A2B3FB450E5901E700FF78FB /* cli.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = cli.c; path = cli/cli.c; sourceTree = "<group>"; };
                A2B5BB7A0D9C7C2300FCB650 /* es */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = es; path = macosx/es.lproj/AddWindow.xib; sourceTree = "<group>"; };
                A2B6141B1395ADE9000E0975 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
                                A25BFD68167BED3B0039D1AA /* variant.h */,
                                A2EA522F1686AC0D00180493 /* quark.c */,
                                A2EA52301686AC0D00180493 /* quark.h */,
+                               A2AF23C616B44FA0003BC59E /* log.c */,
+                               A2AF23C716B44FA0003BC59E /* log.h */,
                                A2A4EA0B0DE106E8000CE197 /* ConvertUTF.h */,
                                A2A4EA0A0DE106E8000CE197 /* ConvertUTF.c */,
                                4DB74F070E8CD75100AEB1A8 /* wildmat.c */,
                                A25BFD6A167BED3B0039D1AA /* variant-common.h in Headers */,
                                A25BFD6E167BED3B0039D1AA /* variant.h in Headers */,
                                A2EA52321686AC0D00180493 /* quark.h in Headers */,
+                               A2AF23C916B44FA0003BC59E /* log.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A25BFD6B167BED3B0039D1AA /* variant-json.c in Sources */,
                                A25BFD6D167BED3B0039D1AA /* variant.c in Sources */,
                                A2EA52311686AC0D00180493 /* quark.c in Sources */,
+                               A2AF23C816B44FA0003BC59E /* log.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index dbee4160280988ff8c1744b5b6740ab2d7178c54..b86a701e83ab7df09eba36b6b1b70c9483fa9544 100644 (file)
@@ -279,7 +279,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
                                                                     stringByExpandingTildeInPath] UTF8String]);
         tr_variantDictAddBool(&settings, TR_KEY_incomplete_dir_enabled, [fDefaults boolForKey: @"UseIncompleteDownloadFolder"]);
         tr_variantDictAddBool(&settings, TR_KEY_lpd_enabled, [fDefaults boolForKey: @"LocalPeerDiscoveryGlobal"]);
-        tr_variantDictAddInt(&settings, TR_KEY_message_level, TR_MSG_DBG);
+        tr_variantDictAddInt(&settings, TR_KEY_message_level, TR_LOG_DEBUG);
         tr_variantDictAddInt(&settings, TR_KEY_peer_limit_global, [fDefaults integerForKey: @"PeersTotal"]);
         tr_variantDictAddInt(&settings, TR_KEY_peer_limit_per_torrent, [fDefaults integerForKey: @"PeersTorrent"]);
         
index 53cf2473a94a19a216aa69ab93ed6bd5e7e4f0f4..ad31f8740bd87dc3c959d9fff2216b9c1f016ded 100644 (file)
@@ -27,8 +27,8 @@
 #import "NSApplicationAdditions.h"
 #import "NSMutableArrayAdditions.h"
 #import "NSStringAdditions.h"
+#import <log.h>
 #import <transmission.h>
-#import <utils.h>
 
 #define LEVEL_ERROR 0
 #define LEVEL_INFO  1
     //select proper level in popup button
     switch ([[NSUserDefaults standardUserDefaults] integerForKey: @"MessageLevel"])
     {
-        case TR_MSG_ERR:
+        case TR_LOG_ERROR:
             [fLevelButton selectItemAtIndex: LEVEL_ERROR];
             break;
-        case TR_MSG_INF:
+        case TR_LOG_INFO:
             [fLevelButton selectItemAtIndex: LEVEL_INFO];
             break;
-        case TR_MSG_DBG:
+        case TR_LOG_DEBUG:
             [fLevelButton selectItemAtIndex: LEVEL_DEBUG];
             break;
         default: //safety
-            [[NSUserDefaults standardUserDefaults] setInteger: TR_MSG_ERR forKey: @"MessageLevel"];
+            [[NSUserDefaults standardUserDefaults] setInteger: TR_LOG_ERROR forKey: @"MessageLevel"];
             [fLevelButton selectItemAtIndex: LEVEL_ERROR];
     }
     
         const NSInteger level = [[message objectForKey: @"Level"] integerValue];
         switch (level)
         {
-            case TR_MSG_ERR:
+            case TR_LOG_ERROR:
                 return [NSImage imageNamed: @"RedDot"];
-            case TR_MSG_INF:
+            case TR_LOG_INFO:
                 return [NSImage imageNamed: @"YellowDot"];
-            case TR_MSG_DBG:
+            case TR_LOG_DEBUG:
                 return [NSImage imageNamed: @"PurpleDot"];
             default:
                 NSAssert1(NO, @"Unknown message log level: %ld", level);
     switch ([fLevelButton indexOfSelectedItem])
     {
         case LEVEL_ERROR:
-            level = TR_MSG_ERR;
+            level = TR_LOG_ERROR;
             break;
         case LEVEL_INFO:
-            level = TR_MSG_INF;
+            level = TR_LOG_INFO;
             break;
         case LEVEL_DEBUG:
-            level = TR_MSG_DBG;
+            level = TR_LOG_DEBUG;
             break;
         default:
             NSAssert1(NO, @"Unknown message log level: %ld", [fLevelButton indexOfSelectedItem]);
     const NSInteger level = [[message objectForKey: @"Level"] integerValue];
     switch (level)
     {
-        case TR_MSG_ERR:
+        case TR_LOG_ERROR:
             levelString = NSLocalizedString(@"Error", "Message window -> level");
             break;
-        case TR_MSG_INF:
+        case TR_LOG_INFO:
             levelString = NSLocalizedString(@"Info", "Message window -> level");
             break;
-        case TR_MSG_DBG:
+        case TR_LOG_DEBUG:
             levelString = NSLocalizedString(@"Debug", "Message window -> level");
             break;
         default:
index 7851f28e550f257795c73e32192f6b9d6494e096..392bd1c7aefa0c86d7c69d6e5fe3608c8bf39778 100644 (file)
@@ -28,6 +28,7 @@
 #import "NSStringAdditions.h"
 #import "TrackerNode.h"
 
+#import "log.h"
 #import "transmission.h" // required by utils.h
 #import "utils.h" // tr_new()
 
@@ -98,11 +99,11 @@ void renameCallback(tr_torrent * torrent, const char * oldPathCharString, const
         
         NSString * oldPath = [NSString stringWithUTF8String: oldPathCharString];
         NSString * path = [oldPath stringByDeletingLastPathComponent];
-        NSString * oldName = [oldPath lastPathComponent];
         NSString * newName = [NSString stringWithUTF8String: newNameCharString];
         
         if (error == 0)
         {
+            NSString * oldName = [oldPath lastPathComponent];
             void (^__block updateNodeAndChildrenForRename)(FileListNode *) = ^(FileListNode * node) {
                 [node updateFromOldName: oldName toNewName: newName inPath: path];
                 
@@ -378,7 +379,7 @@ int trashDataFile(const char * filename)
 {
     if (fResumeOnWake)
     {
-        tr_ninf( fInfo->name, "restarting because of wakeUp" );
+        tr_logAddNamedInfo( fInfo->name, "restarting because of wakeUp" );
         tr_torrentStart(fHandle);
     }
 }
@@ -854,7 +855,6 @@ int trashDataFile(const char * filename)
 
 - (void) renameFileNode: (FileListNode *) node withName: (NSString *) newName completionHandler: (void (^)(BOOL didRename)) completionHandler
 {
-    NSParameterAssert(node != nil);
     NSParameterAssert([node torrent] == self);
     NSParameterAssert(newName != nil);
     NSParameterAssert(![newName isEqualToString: @""]);