Updated Branches: refs/heads/master 02d212ab4 -> 29b894298
[CB-623] added Logger plugin see: https://issues.apache.org/jira/browse/CB-623 added: CordovaLib/Classes/CDVLogger.h CordovaLib/Classes/CDVLogger.m modified to add to built-in plugin list: Cordova-based Application/Cordova.plist CordovaLib/CordovaLibApp/Cordova.plist bin/templates/project/__TESTING__/Cordova.plist modified to add to targets Cordova and CordovaLib: CordovaLib/CordovaLib.xcodeproj/project.pbxproj Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/29b89429 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/29b89429 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/29b89429 Branch: refs/heads/master Commit: 29b89429805283fa85929b55fd46221e65edce5a Parents: 02d212a Author: Patrick Mueller <pmue...@apache.org> Authored: Mon May 21 11:55:26 2012 -0400 Committer: Patrick Mueller <pmue...@apache.org> Committed: Mon May 21 11:55:26 2012 -0400 ---------------------------------------------------------------------- Cordova-based Application/Cordova.plist | 22 +--------- CordovaLib/Classes/CDVLogger.h | 26 ++++++++++++ CordovaLib/Classes/CDVLogger.m | 39 ++++++++++++++++++ CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 32 +++++--------- CordovaLib/CordovaLibApp/Cordova.plist | 2 + bin/templates/project/__TESTING__/Cordova.plist | 2 + 6 files changed, 83 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/29b89429/Cordova-based Application/Cordova.plist ---------------------------------------------------------------------- diff --git a/Cordova-based Application/Cordova.plist b/Cordova-based Application/Cordova.plist index b46abdd..2ec597d 100644 --- a/Cordova-based Application/Cordova.plist +++ b/Cordova-based Application/Cordova.plist @@ -1,25 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<!-- -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---> <plist version="1.0"> <dict> <key>UIWebViewBounce</key> @@ -44,6 +24,8 @@ <array/> <key>Plugins</key> <dict> + <key>Logger</key> + <string>CDVLogger</string> <key>Compass</key> <string>CDVLocation</string> <key>Accelerometer</key> http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/29b89429/CordovaLib/Classes/CDVLogger.h ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVLogger.h b/CordovaLib/Classes/CDVLogger.h new file mode 100644 index 0000000..68e9040 --- /dev/null +++ b/CordovaLib/Classes/CDVLogger.h @@ -0,0 +1,26 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CDVPlugin.h" + +@interface CDVLogger : CDVPlugin + +- (void) logLevel:(NSArray*)arguments withDict:(NSMutableDictionary*)options; + +@end http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/29b89429/CordovaLib/Classes/CDVLogger.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVLogger.m b/CordovaLib/Classes/CDVLogger.m new file mode 100644 index 0000000..0a3b4f8 --- /dev/null +++ b/CordovaLib/Classes/CDVLogger.m @@ -0,0 +1,39 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +#import "CDVLogger.h" +#import "CDV.h" + +@implementation CDVLogger + +/* log a message */ +- (void) logLevel:(NSArray*)arguments withDict:(NSMutableDictionary*)options; +{ + id level = [arguments objectAtIndex:1]; + id message = [arguments objectAtIndex:2]; + + if ([level isEqualToString:@"LOG"]) { + NSLog(@"%@", message); + } + else { + NSLog(@"%@: %@", level, message); + } +} + +@end \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/29b89429/CordovaLib/CordovaLib.xcodeproj/project.pbxproj ---------------------------------------------------------------------- diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj index e94ed0f..d723c7d 100644 --- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj +++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj @@ -1,24 +1,4 @@ // !$*UTF8*$! -/* -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -*/ { archiveVersion = 1; classes = { @@ -154,6 +134,10 @@ 30F8AE0C152125B6006625B3 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 686357D214100AE700DF4CF2 /* MobileCoreServices.framework */; }; 30F8AE13152127CE006625B3 /* Cordova.plist in Resources */ = {isa = PBXBuildFile; fileRef = 30F8AE12152127CE006625B3 /* Cordova.plist */; }; 30F8AE1D152129DA006625B3 /* www in Resources */ = {isa = PBXBuildFile; fileRef = 30F8AE1C152129DA006625B3 /* www */; }; + 3E76876D156A90EE00EB6FA3 /* CDVLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E76876B156A90EE00EB6FA3 /* CDVLogger.m */; }; + 3E76876E156A90EE00EB6FA3 /* CDVLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E76876B156A90EE00EB6FA3 /* CDVLogger.m */; }; + 3E76876F156A90EE00EB6FA3 /* CDVLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E76876C156A90EE00EB6FA3 /* CDVLogger.h */; }; + 3E768770156A90EE00EB6FA3 /* CDVLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E76876C156A90EE00EB6FA3 /* CDVLogger.h */; }; 686357B5141002F200DF4CF2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 686357B3141002F200DF4CF2 /* InfoPlist.strings */; }; 686357BA141002F200DF4CF2 /* CDVPluginResultJSONSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 686357B9141002F200DF4CF2 /* CDVPluginResultJSONSerializationTests.m */; }; 68A32D7514103017006B237C /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68A32D7414103017006B237C /* AddressBook.framework */; }; @@ -274,6 +258,8 @@ 30F5EBA914CA26E700987760 /* CDVCommandDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVCommandDelegate.h; path = Classes/CDVCommandDelegate.h; sourceTree = "<group>"; }; 30F8AE12152127CE006625B3 /* Cordova.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Cordova.plist; path = "../../Cordova-based Application/Cordova.plist"; sourceTree = "<group>"; }; 30F8AE1C152129DA006625B3 /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = "<group>"; }; + 3E76876B156A90EE00EB6FA3 /* CDVLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVLogger.m; path = Classes/CDVLogger.m; sourceTree = "<group>"; }; + 3E76876C156A90EE00EB6FA3 /* CDVLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVLogger.h; path = Classes/CDVLogger.h; sourceTree = "<group>"; }; 686357A9141002F100DF4CF2 /* CordovaLibTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CordovaLibTests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; 686357AA141002F100DF4CF2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 686357AC141002F100DF4CF2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -545,6 +531,8 @@ 8887FD5F1090FBE7009987E8 /* CDVReachability.m */, 8887FD601090FBE7009987E8 /* CDVSound.h */, 8887FD611090FBE7009987E8 /* CDVSound.m */, + 3E76876B156A90EE00EB6FA3 /* CDVLogger.m */, + 3E76876C156A90EE00EB6FA3 /* CDVLogger.h */, ); name = Commands; sourceTree = "<group>"; @@ -626,6 +614,7 @@ 301F2F2B14F3C9CA003FE9FC /* CDV.h in Headers */, 3062D121151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */, 3034979D1513D56A0090E688 /* CDVLocalStorage.h in Headers */, + 3E768770156A90EE00EB6FA3 /* CDVLogger.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -666,6 +655,7 @@ 30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */, 3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */, 3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */, + 3E76876F156A90EE00EB6FA3 /* CDVLogger.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -917,6 +907,7 @@ 30A90B9414588697006178D3 /* JSONKit.m in Sources */, 3034979F1513D56A0090E688 /* CDVLocalStorage.m in Sources */, 3062D123151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */, + 3E76876E156A90EE00EB6FA3 /* CDVLogger.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -975,6 +966,7 @@ 8852C44114B65FD800F0E735 /* CDVCordovaView.m in Sources */, 3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */, 3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */, + 3E76876D156A90EE00EB6FA3 /* CDVLogger.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/29b89429/CordovaLib/CordovaLibApp/Cordova.plist ---------------------------------------------------------------------- diff --git a/CordovaLib/CordovaLibApp/Cordova.plist b/CordovaLib/CordovaLibApp/Cordova.plist index b46abdd..771caac 100644 --- a/CordovaLib/CordovaLibApp/Cordova.plist +++ b/CordovaLib/CordovaLibApp/Cordova.plist @@ -44,6 +44,8 @@ <array/> <key>Plugins</key> <dict> + <key>Logger</key> + <string>CDVLogger</string> <key>Compass</key> <string>CDVLocation</string> <key>Accelerometer</key> http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/29b89429/bin/templates/project/__TESTING__/Cordova.plist ---------------------------------------------------------------------- diff --git a/bin/templates/project/__TESTING__/Cordova.plist b/bin/templates/project/__TESTING__/Cordova.plist index 7068037..e36934d 100644 --- a/bin/templates/project/__TESTING__/Cordova.plist +++ b/bin/templates/project/__TESTING__/Cordova.plist @@ -44,6 +44,8 @@ <array/> <key>Plugins</key> <dict> + <key>Logger</key> + <string>CDVLogger</string> <key>Compass</key> <string>CDVLocation</string> <key>Accelerometer</key>