You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by he...@apache.org on 2013/05/20 22:31:07 UTC

[3/4] git commit: added native iOS classes

added native iOS classes


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-console/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-console/commit/bd6ea34c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-console/tree/bd6ea34c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-console/diff/bd6ea34c

Branch: refs/heads/master
Commit: bd6ea34cb6c5b0c85aa162399ee16d373c582500
Parents: 693a33f
Author: hermwong <he...@gmail.com>
Authored: Mon May 20 13:30:01 2013 -0700
Committer: hermwong <he...@gmail.com>
Committed: Mon May 20 13:30:01 2013 -0700

----------------------------------------------------------------------
 src/ios/CDVLogger.h |   26 ++++++++++++++++++++++++++
 src/ios/CDVLogger.m |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-console/blob/bd6ea34c/src/ios/CDVLogger.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVLogger.h b/src/ios/CDVLogger.h
new file mode 100644
index 0000000..eeba63c
--- /dev/null
+++ b/src/ios/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:(CDVInvokedUrlCommand*)command;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-plugin-console/blob/bd6ea34c/src/ios/CDVLogger.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVLogger.m b/src/ios/CDVLogger.m
new file mode 100644
index 0000000..a37cf8a
--- /dev/null
+++ b/src/ios/CDVLogger.m
@@ -0,0 +1,38 @@
+/*
+ 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:(CDVInvokedUrlCommand*)command
+{
+    id level = [command.arguments objectAtIndex:0];
+    id message = [command.arguments objectAtIndex:1];
+
+    if ([level isEqualToString:@"LOG"]) {
+        NSLog(@"%@", message);
+    } else {
+        NSLog(@"%@: %@", level, message);
+    }
+}
+
+@end