Skip to content

Commit c7a90f4

Browse files
committed
Separate log and debug
1 parent 9e065ef commit c7a90f4

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/config-dev.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var configs = {
22
title: 'Explode layer tool',
3+
debug : false,
34
log : true,
45
itemAmountWarning : 50,
56
};

src/explode_shape_layer.jsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
function explodeLayer(layer) {
77

8-
consLog('==============\n==============');
8+
cLog('Exploding layer : ' + layer.name + '\n==================');
99

1010
// Get the elements of the original shape layer
1111
var contents = layer.property("Contents");
@@ -101,7 +101,7 @@ function copyProperties(origin, target, prefix) {
101101

102102
if(!_prop.enabled || !target.canAddProperty(_prop.matchName)) return;
103103

104-
consLog(prefix + _prop.matchName);
104+
cDebug(prefix + _prop.matchName);
105105

106106
var prop = target.addProperty(_prop.matchName);
107107

@@ -112,7 +112,7 @@ function copyProperties(origin, target, prefix) {
112112
break;
113113

114114
case 'ADBE Vector Materials Group':
115-
consLog(prefix + '-- skipped');
115+
cDebug(prefix + '-- skipped');
116116
break;
117117

118118
case 'ADBE Vector Graphic - Stroke':
@@ -260,14 +260,8 @@ function createUI(that) {
260260

261261
btn.onClick = function() {
262262

263-
var startTime = new Date().getTime();
264-
265263
explode();
266264

267-
var execTime = new Date().getTime() - startTime;
268-
269-
consLog('Execution time : ' + Math.floor(execTime / 1000) + 's ' + (execTime % 1000) + 'ms');
270-
271265
}
272266

273267
return _panel;

src/utils.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
function consLog(text) {
1+
function cLog(text) {
22
if (configs.log)
33
$.writeln(text);
44
}
55

6+
function cDebug(text) {
7+
if (configs.debug)
8+
$.writeln(text);
9+
}
10+
611
function listMatchNames(object) {
712

813
for(var i=1; i <= object.numProperties; i++) {

0 commit comments

Comments
 (0)