Fix: Log error message and times display

This commit is contained in:
surunzi
2016-05-15 17:56:40 +08:00
parent 6c3ebed115
commit 714a0f91cc
3 changed files with 37 additions and 11 deletions

View File

@@ -52,7 +52,7 @@ export default class Log extends util.Emitter
type: 'input',
ignoreFilter: true,
isCode: true,
src: src,
src,
val: jsCode
});
@@ -118,11 +118,16 @@ export default class Log extends util.Emitter
}
error(msg)
{
var src = msg,
ignoreFilter = false;
if (util.isUndef(msg)) return;
var ignoreFilter = false, src;
if (util.isErr(msg))
{
src = {
stack: msg.stack,
message: msg.message || ''
};
ignoreFilter = msg.ignoreFilter;
msg = errToStr(msg);
} else
@@ -133,7 +138,7 @@ export default class Log extends util.Emitter
this._insert({
type: 'error',
ignoreFilter: ignoreFilter,
src: src,
src,
val: msg
});
@@ -349,6 +354,9 @@ function transMsg(msg, noEscape)
} else if (util.isUndef(msg))
{
msg = 'undefined';
} else if (msg === null)
{
msg = 'null';
}
msg = util.toStr(msg);

View File

@@ -1,12 +1,16 @@
<ul>
{{#each logs}}
<li class="eruda-{{type}} eruda-log-item" data-idx="{{@index}}">
{{#if showTimes}}<span class="eruda-times">{{times}}</span>{{/if}}
{{#if isCode}}
<pre>{{{val}}}</pre>
{{else}}
{{{val}}}
{{/if}}
{{#if showTimes}}<div class="eruda-times">{{times}}</div>{{/if}}
<div class="eruda-log-content-wrapper">
<div class="eruda-log-content">
{{#if isCode}}
<pre>{{{val}}}</pre>
{{else}}
{{{val}}}
{{/if}}
</div>
</div>
</li>
{{/each}}
</ul>

View File

@@ -9,7 +9,11 @@
font-size: 14px;
li {
padding: 10px;
overflow-x: auto;
&:after {
content: '';
display: block;
clear: both;
}
a {
color: $blue !important;
}
@@ -18,6 +22,16 @@
padding: 5px;
color: #fff;
border-radius: 4px;
float: left;
margin-right: 5px;
}
.log-content-wrapper {
overflow: hidden;
}
.log-content
{
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
&.input {
background: #fff;