Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Maiz committed Feb 2, 2019
2 parents e15e54e + 3ea372a commit d1553b7
Show file tree
Hide file tree
Showing 13 changed files with 1,858 additions and 1,399 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
English | [简体中文](./CHANGELOG_CN.md)

#### V3.3.0 (2019-02-02)

- [FEATURE] Add the ability to collapse the same log.
- [FIX] Fix issue which formatted log (like `console.log('[foo]', 'bar')`) will not display in Log tab.


#### V3.2.2 (2019-01-17)

- [FEATURE] Add console command prompt. (by @65147400)
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[English](./CHANGELOG.md) | 简体中文

#### V3.3.0 (2019-02-02)

- 【特效】新增自动合并相同日志的能力。频繁输出相同日志时不再会被刷屏。
- 【修复】修复格式化日志(如 `console.log('[foo]', 'bar')`)无法显示到 Log 面板的问题。


#### V3.2.2 (2019-01-17)

- 【特性】新增控制台输入提示。 (by @65147400)
Expand Down
4 changes: 2 additions & 2 deletions dist/vconsole.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ console.error('bar'); // red word, pink background
```


### Other methods

Supported `console` methods:

```javascript
console.time('foo'); // start a timer named "foo"
console.timeEnd('foo'); // stop "foo" timer and print the elapsed time
```


### Formatted object / array

Object or Array variable will be printed as formatted JSON:
Expand Down
16 changes: 16 additions & 0 deletions doc/tutorial_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ console.error('bar'); // 红底红字
```


### 其他方法

支持以下 `console` 方法:

```javascript
console.time('foo'); // 启动名为 foo 的计时器
console.timeEnd('foo'); // 停止 foo 计时器并输出经过的时间
```


### Object/Array 结构化展示

支持打印 Object 或 Array 变量,会以结构化 JSON 形式输出(并折叠):
Expand Down Expand Up @@ -118,6 +128,12 @@ console.log('[system]', 'foo'); // 'foo' 会输出到 System 面板
console.log('[system] bar'); // 这行日志会输出到 Log 面板而非 System 面板
```

若编写自定义 log 面板插件,亦可通过上述格式将 log 输出到自定义面板:

```javascript
console.log('[myplugin]', 'bar'); // 'myplugin' 为自定义面板插件的 id
```


## 内置插件

Expand Down
3,010 changes: 1,669 additions & 1,341 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vconsole",
"version": "3.2.2",
"version": "3.3.0",
"description": "A lightweight, extendable front-end developer tool for mobile web page.",
"homepage": "https://github.com/Tencent/vConsole",
"main": "dist/vconsole.min.js",
Expand All @@ -20,22 +20,22 @@
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.3.1",
"@babel/preset-env": "^7.3.1",
"babel-loader": "^8.0.4",
"babel-plugin-add-module-exports": "^1.0.0",
"chai": "^4.2.0",
"css-loader": "^2.1.0",
"html-loader": "^0.5.5",
"jsdom": "^13.1.0",
"jsdom": "^13.2.0",
"json-loader": "^0.5.7",
"less": "^3.9.0",
"less-loader": "^4.1.0",
"mocha": "^5.2.0",
"style-loader": "^0.23.1",
"webpack": "^4.28.4",
"webpack": "^4.29.0",
"webpack-cli": "^3.2.1"
},
"author": "Tencent",
Expand Down
32 changes: 15 additions & 17 deletions src/core/core.less
Original file line number Diff line number Diff line change
Expand Up @@ -213,28 +213,26 @@

.vc-item-content {
margin-right: 60em / @font;
display: block;
display: inline-block;
}

.vc-item-meta {
color: #888;
float: right;
width: 60em / @font;
text-align: right;
.vc-item-repeat {
display: inline-block;
margin-right: 4em / @font;
padding: 0 @fontSize / 2;
color: #D7E0EF;
background-color: #42597F;
border-radius: @fontSize / 1.5;
}

}

.vc-item.vc-item-nometa {

.vc-item-content {
margin-right: 0;
}

.vc-item-meta {
display: none;
}

.vc-item.vc-item-error .vc-item-repeat {
color: #901818;
background-color: #DC2727;
}
.vc-item.vc-item-warn .vc-item-repeat {
color: #987D20;
background-color: #F4BD02;
}

.vc-item .vc-item-code {
Expand Down
8 changes: 5 additions & 3 deletions src/log/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ class VConsoleDefaultTab extends VConsoleLogTab {
//print error stack info
let stack = !!error && !!error.stack;
let statckInfo = (stack && error.stack.toString()) || '';
that.printLog({logType: 'error', logs: [msg, statckInfo], noOrigin: true});
that.printLog({
logType: 'error',
logs: [msg, statckInfo],
noOrigin: true
});
if (tool.isFunction(that.windowOnError)) {
that.windowOnError.call(window, message, source, lineNo, colNo, error);
}
Expand All @@ -224,7 +228,6 @@ class VConsoleDefaultTab extends VConsoleLogTab {
this.printLog({
logType: 'log',
content: $.render(tplItemCode, {content: cmd, type: 'input'}),
noMeta: true,
style: ''
});
// do not use `eval` or `new Function` to avoid `unsafe-eval` CSP rule
Expand Down Expand Up @@ -289,7 +292,6 @@ class VConsoleDefaultTab extends VConsoleLogTab {
this.printLog({
logType: 'log',
content: $content,
noMeta: true,
style: ''
});
window.winKeys = Object.getOwnPropertyNames(window).sort();
Expand Down
3 changes: 1 addition & 2 deletions src/log/item.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<div class="vc-item vc-item-{{logType}} {{if (!noMeta)}}vc-item-nometa{{/if}} {{style}}">
<span class="vc-item-meta">{{if (!noMeta)}}{{meta}}{{/if}}</span>
<div id="{{_id}}" class="vc-item vc-item-{{logType}} {{style}}">
<div class="vc-item-content"></div>
</div>
Loading

0 comments on commit d1553b7

Please sign in to comment.