/usr/share/javascript/yui3/yui-log-nodejs/yui-log-nodejs.js is in libjs-yui3-full 3.5.1-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | /*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('yui-log-nodejs', function(Y) {
var sys = require(process.binding('natives').util ? 'util' : 'sys'),
hasColor = false;
try {
var stdio = require("stdio");
hasColor = stdio.isStderrATTY();
} catch (ex) {
hasColor = true;
}
Y.config.useColor = hasColor;
Y.consoleColor = function(str, num) {
if (!this.config.useColor) {
return str;
}
if (!num) {
num = '32';
}
return "\033[" + num +"m" + str + "\033[0m"
};
var logFn = function(str, t, m) {
var id = '';
if (this.id) {
id = '[' + this.id + ']:';
}
t = t || 'info';
m = (m) ? this.consoleColor(' (' + m.toLowerCase() + '):', 35) : '';
if (str === null) {
str = 'null';
}
if ((typeof str === 'object') || str instanceof Array) {
try {
//Should we use this?
if (str.tagName || str._yuid || str._query) {
str = str.toString();
} else {
str = sys.inspect(str);
}
} catch (e) {
//Fail catcher
}
}
var lvl = '37;40', mLvl = ((str) ? '' : 31);
t = t+''; //Force to a string..
switch (t.toLowerCase()) {
case 'error':
lvl = mLvl = 31;
break;
case 'warn':
lvl = 33;
break;
case 'debug':
lvl = 34;
break;
}
if (typeof str === 'string') {
if (str && str.indexOf("\n") !== -1) {
str = "\n" + str;
}
}
// output log messages to stderr
sys.error(this.consoleColor(t.toLowerCase() + ':', lvl) + m + ' ' + this.consoleColor(str, mLvl));
};
if (!Y.config.logFn) {
Y.config.logFn = logFn;
}
}, '3.5.1' ,{requires:['yui-log']});
|