openEventsPlatformApp/plugins/cordova-plugin-console/README.md
plugins/cordova-plugin-console/README.mdRaw
1---
2title: Console
3description: Get JavaScript logs in your native logs.
4---
5<!---
6# license: Licensed to the Apache Software Foundation (ASF) under one
7# or more contributor license agreements. See the NOTICE file
8# distributed with this work for additional information
9# regarding copyright ownership. The ASF licenses this file
10# to you under the Apache License, Version 2.0 (the
11# "License"); you may not use this file except in compliance
12# with the License. You may obtain a copy of the License at
13#
14# http://www.apache.org/licenses/LICENSE-2.0
15#
16# Unless required by applicable law or agreed to in writing,
17# software distributed under the License is distributed on an
18# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19# KIND, either express or implied. See the License for the
20# specific language governing permissions and limitations
21# under the License.
22-->
23
24|Android|iOS| Windows 8.1 Store | Windows 8.1 Phone | Windows 10 Store | Travis CI |
25|:-:|:-:|:-:|:-:|:-:|:-:|
26|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-console/)|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-console/)|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-console/)|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-console/)|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-console/)|[](https://travis-ci.org/apache/cordova-plugin-console)
27
28# cordova-plugin-console
29
30This plugin is meant to ensure that console.log() is as useful as it can be.
31It adds additional function for iOS, Ubuntu, Windows Phone 8, and Windows. If
32you are happy with how console.log() works for you, then you probably
33don't need this plugin.
34
35This plugin defines a global `console` object.
36
37Although the object is in the global scope, features provided by this plugin
38are not available until after the `deviceready` event.
39
40 document.addEventListener("deviceready", onDeviceReady, false);
41 function onDeviceReady() {
42 console.log("console.log works well");
43 }
44
45:warning: Report issues on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Console%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC)
46
47
48## Installation
49
50 cordova plugin add cordova-plugin-console
51
52### Android Quirks
53
54On some platforms other than Android, console.log() will act on multiple
55arguments, such as console.log("1", "2", "3"). However, Android will act only
56on the first argument. Subsequent arguments to console.log() will be ignored.
57This plugin is not the cause of that, it is a limitation of Android itself.
58
59## Supported Methods
60
61The plugin support following methods of the `console` object:
62
63- `console.log`
64- `console.error`
65- `console.exception`
66- `console.warn`
67- `console.info`
68- `console.debug`
69- `console.assert`
70- `console.dir`
71- `console.dirxml`
72- `console.time`
73- `console.timeEnd`
74- `console.table`
75
76## Partially supported Methods
77
78Methods of the `console` object which implemented, but behave different from browser implementation:
79
80- `console.group`
81- `console.groupCollapsed`
82
83The grouping methods are just log name of the group and don't actually indicate grouping for later
84calls to `console` object methods.
85
86## Not supported Methods
87
88Methods of the `console` object which are implemented, but do nothing:
89
90- `console.clear`
91- `console.trace`
92- `console.groupEnd`
93- `console.timeStamp`
94- `console.profile`
95- `console.profileEnd`
96- `console.count`
97
98## Supported formatting
99
100The following formatting options available:
101
102Format chars:
103
104* `%j` - format arg as JSON
105* `%o` - format arg as JSON
106* `%c` - format arg as `''`. No color formatting could be done.
107* `%%` - replace with `'%'`
108
109Any other char following `%` will format its arg via `toString()`.