@akc42/server-utils 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/debug.js +3 -3
- package/logger.js +7 -1
- package/package.json +1 -1
package/debug.js
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
You should have received a copy of the GNU General Public License
|
|
18
18
|
along with Server Utils. If not, see <http://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
import chalk from 'chalk';
|
|
22
|
-
let config = '';
|
|
22
|
+
let config = process.env.DEBUG || '';
|
|
23
23
|
let cache = [];
|
|
24
24
|
let cachelimit = 50;
|
|
25
25
|
|
|
@@ -40,7 +40,7 @@ export function Debug (topic) {
|
|
|
40
40
|
}, '');
|
|
41
41
|
const output = `${chalk.greenBright(topic)} ${chalk.cyan(message)} ${chalk.whiteBright(`(${gap}ms)`)}`
|
|
42
42
|
if (enabled) {
|
|
43
|
-
|
|
43
|
+
//eslint-disable-next-line no-console
|
|
44
44
|
console.log(output);
|
|
45
45
|
}
|
|
46
46
|
cache.push(output);
|
package/logger.js
CHANGED
|
@@ -49,7 +49,13 @@ function cyrb53 (str, seed = 0) {
|
|
|
49
49
|
export default function logger(ip,level, ...messages) {
|
|
50
50
|
if (process.env.LOG_NONE === undefined) {
|
|
51
51
|
let logLine = '';
|
|
52
|
-
if (typeof process.env.LOG_NO_DATE === 'undefined')
|
|
52
|
+
if (typeof process.env.LOG_NO_DATE === 'undefined') {
|
|
53
|
+
if (typeof process.env.LOG_ISO_DATE !== 'undefined') {
|
|
54
|
+
logLine += new Date().toISOString() + ': ';
|
|
55
|
+
} else {
|
|
56
|
+
logLine += new Date().toISOString().substring(0,10) + ' ' + new Date().toLocaleTimeString() + ': ';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
53
59
|
let message;
|
|
54
60
|
let logcolor;
|
|
55
61
|
if (isIP(ip) === 0 ) {
|