Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: appengine_apps/chromium_status/static/js/common/debug.js

Issue 778533003: Moved chromium_status to appengine/ (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * Hacky helpers for debugging...
7 */
8
9 function Log(msg) {
10 if (msg) {
11 var d = document.getElementById('log');
12 if (d) {
13 d.appendChild(document.createTextNode(msg + "\n"));
14 }
15 console.log(msg);
16 }
17 }
18
19 function DumpTimestamp(t) {
20 var d = new Date();
21 d.setTime(t);
22 return d.toLocaleString();
23 }
24
25 function DumpUTCTimestamp(t) {
26 var d = new Date();
27 d.setTime(t);
28 return d.toUTCString();
29 }
30
31 function DumpObj(obj, opt_name) {
32 if (typeof obj == "string") {
33 return "\"" + obj.toString() + "\"";
34 }
35
36 if (typeof obj != "object") {
37 return "" + obj
38 }
39
40 var str = "";
41
42 if (obj instanceof Array) {
43 for (var i = 0; i < obj.length; ++i) {
44 if (i > 0)
45 str += ", ";
46 str += DumpObj(obj[i]);
47 }
48 return "[" + str + "]";
49 }
50
51 var i = 0;
52 for (var key in obj) {
53 if (typeof obj[key] == "function") {
54 continue;
55 }
56 if (i > 0)
57 str += ", ";
58 str += key + ": " + DumpObj(obj[key]);
59 i++;
60 }
61
62 return "{" + str + "}";
63 }
64
65 function LogRun(run) {
66 Log("startTime: " + DumpTimestamp(run.startTime));
67 Log("endTime: " + DumpTimestamp(run.GetEndTime()));
68 Log("duration (minutes): " + run.duration / (1000 * 60));
69 Log("timestamp: " + DumpTimestamp(run.entry.timestamp));
70 }
71
72 function LogObject(obj, opt_name) {
73 var prefix = "";
74 if (opt_name)
75 prefix = opt_name + "= ";
76 Log(prefix + DumpObj(obj));
77 }
78
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698