@icreate/core
Advanced tools
Comparing version 0.0.17 to 0.0.18
@@ -170,3 +170,3 @@ /* | ||
* @LastEditors: 文贝 | ||
* @LastEditTime: 2022-03-11 08:50:22 | ||
* @LastEditTime: 2022-03-11 09:41:09 | ||
* @Descripttion: | ||
@@ -178,5 +178,13 @@ * @FilePath: \src\core\logger.ts | ||
this.level = LogLevels.DEBUG; | ||
this.color = { | ||
debug: '#569cd6', | ||
info: '#b5cea8', | ||
warn: '#ce9178', | ||
error: '#ce9178', | ||
fatal: '#ce9178' | ||
}; | ||
} | ||
Logger.prototype.log = function (logObject, logLevel) { | ||
if (!window.console || !window.console.log) { | ||
Logger.prototype.log = function (logObject, logLevel, color) { | ||
if (color === void 0) { color = '#b5cea8'; } | ||
if (typeof window === 'undefined' || !window.console || !window.console.log) { | ||
return; | ||
@@ -187,3 +195,3 @@ } | ||
} | ||
console.log(logObject); | ||
console.log(logObject, "color: " + color + ";font-size: 14px;font-weight: normal;line-height: 19px;font-family: Consolas, \"Courier New\", monospace;"); | ||
}; | ||
@@ -196,4 +204,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("DEBUG: " + message, LogLevels.DEBUG); | ||
this.log(logObject, LogLevels.DEBUG); | ||
this.log("DEBUG: " + message, LogLevels.DEBUG, this.color.debug); | ||
this.log(logObject, LogLevels.DEBUG, this.color.debug); | ||
}; | ||
@@ -206,4 +214,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("INFO: " + message, LogLevels.INFO); | ||
this.log(logObject, LogLevels.INFO); | ||
this.log("INFO: " + message, LogLevels.INFO, this.color.info); | ||
this.log(logObject, LogLevels.INFO, this.color.info); | ||
}; | ||
@@ -216,4 +224,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("WARN: " + message, LogLevels.WARN); | ||
this.log(logObject, LogLevels.WARN); | ||
this.log("WARN: " + message, LogLevels.WARN, this.color.warn); | ||
this.log(logObject, LogLevels.WARN, this.color.warn); | ||
}; | ||
@@ -226,4 +234,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("ERROR: " + message, LogLevels.ERROR); | ||
this.log(logObject, LogLevels.ERROR); | ||
this.log("ERROR: " + message, LogLevels.ERROR, this.color.error); | ||
this.log(logObject, LogLevels.ERROR, this.color.error); | ||
}; | ||
@@ -236,4 +244,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("FATAL: " + message, LogLevels.FATAL); | ||
this.log(logObject, LogLevels.FATAL); | ||
this.log("FATAL: " + message, LogLevels.FATAL, this.color.fatal); | ||
this.log(logObject, LogLevels.FATAL, this.color.fatal); | ||
}; | ||
@@ -240,0 +248,0 @@ return Logger; |
@@ -175,3 +175,3 @@ (function (global, factory) { | ||
* @LastEditors: 文贝 | ||
* @LastEditTime: 2022-03-11 08:50:22 | ||
* @LastEditTime: 2022-03-11 09:41:09 | ||
* @Descripttion: | ||
@@ -183,5 +183,13 @@ * @FilePath: \src\core\logger.ts | ||
this.level = exports.LogLevels.DEBUG; | ||
this.color = { | ||
debug: '#569cd6', | ||
info: '#b5cea8', | ||
warn: '#ce9178', | ||
error: '#ce9178', | ||
fatal: '#ce9178' | ||
}; | ||
} | ||
Logger.prototype.log = function (logObject, logLevel) { | ||
if (!window.console || !window.console.log) { | ||
Logger.prototype.log = function (logObject, logLevel, color) { | ||
if (color === void 0) { color = '#b5cea8'; } | ||
if (typeof window === 'undefined' || !window.console || !window.console.log) { | ||
return; | ||
@@ -192,3 +200,3 @@ } | ||
} | ||
console.log(logObject); | ||
console.log(logObject, "color: " + color + ";font-size: 14px;font-weight: normal;line-height: 19px;font-family: Consolas, \"Courier New\", monospace;"); | ||
}; | ||
@@ -201,4 +209,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("DEBUG: " + message, exports.LogLevels.DEBUG); | ||
this.log(logObject, exports.LogLevels.DEBUG); | ||
this.log("DEBUG: " + message, exports.LogLevels.DEBUG, this.color.debug); | ||
this.log(logObject, exports.LogLevels.DEBUG, this.color.debug); | ||
}; | ||
@@ -211,4 +219,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("INFO: " + message, exports.LogLevels.INFO); | ||
this.log(logObject, exports.LogLevels.INFO); | ||
this.log("INFO: " + message, exports.LogLevels.INFO, this.color.info); | ||
this.log(logObject, exports.LogLevels.INFO, this.color.info); | ||
}; | ||
@@ -221,4 +229,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("WARN: " + message, exports.LogLevels.WARN); | ||
this.log(logObject, exports.LogLevels.WARN); | ||
this.log("WARN: " + message, exports.LogLevels.WARN, this.color.warn); | ||
this.log(logObject, exports.LogLevels.WARN, this.color.warn); | ||
}; | ||
@@ -231,4 +239,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("ERROR: " + message, exports.LogLevels.ERROR); | ||
this.log(logObject, exports.LogLevels.ERROR); | ||
this.log("ERROR: " + message, exports.LogLevels.ERROR, this.color.error); | ||
this.log(logObject, exports.LogLevels.ERROR, this.color.error); | ||
}; | ||
@@ -241,4 +249,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("FATAL: " + message, exports.LogLevels.FATAL); | ||
this.log(logObject, exports.LogLevels.FATAL); | ||
this.log("FATAL: " + message, exports.LogLevels.FATAL, this.color.fatal); | ||
this.log(logObject, exports.LogLevels.FATAL, this.color.fatal); | ||
}; | ||
@@ -245,0 +253,0 @@ return Logger; |
@@ -7,3 +7,3 @@ "use strict"; | ||
* @LastEditors: 文贝 | ||
* @LastEditTime: 2022-03-11 08:50:22 | ||
* @LastEditTime: 2022-03-11 09:41:09 | ||
* @Descripttion: | ||
@@ -16,5 +16,13 @@ * @FilePath: \src\core\logger.ts | ||
this.level = interfaces_1.LogLevels.DEBUG; | ||
this.color = { | ||
debug: '#569cd6', | ||
info: '#b5cea8', | ||
warn: '#ce9178', | ||
error: '#ce9178', | ||
fatal: '#ce9178' | ||
}; | ||
} | ||
Logger.prototype.log = function (logObject, logLevel) { | ||
if (!window.console || !window.console.log) { | ||
Logger.prototype.log = function (logObject, logLevel, color) { | ||
if (color === void 0) { color = '#b5cea8'; } | ||
if (typeof window === 'undefined' || !window.console || !window.console.log) { | ||
return; | ||
@@ -25,3 +33,3 @@ } | ||
} | ||
console.log(logObject); | ||
console.log(logObject, "color: " + color + ";font-size: 14px;font-weight: normal;line-height: 19px;font-family: Consolas, \"Courier New\", monospace;"); | ||
}; | ||
@@ -34,4 +42,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("DEBUG: " + message, interfaces_1.LogLevels.DEBUG); | ||
this.log(logObject, interfaces_1.LogLevels.DEBUG); | ||
this.log("DEBUG: " + message, interfaces_1.LogLevels.DEBUG, this.color.debug); | ||
this.log(logObject, interfaces_1.LogLevels.DEBUG, this.color.debug); | ||
}; | ||
@@ -44,4 +52,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("INFO: " + message, interfaces_1.LogLevels.INFO); | ||
this.log(logObject, interfaces_1.LogLevels.INFO); | ||
this.log("INFO: " + message, interfaces_1.LogLevels.INFO, this.color.info); | ||
this.log(logObject, interfaces_1.LogLevels.INFO, this.color.info); | ||
}; | ||
@@ -54,4 +62,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("WARN: " + message, interfaces_1.LogLevels.WARN); | ||
this.log(logObject, interfaces_1.LogLevels.WARN); | ||
this.log("WARN: " + message, interfaces_1.LogLevels.WARN, this.color.warn); | ||
this.log(logObject, interfaces_1.LogLevels.WARN, this.color.warn); | ||
}; | ||
@@ -64,4 +72,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("ERROR: " + message, interfaces_1.LogLevels.ERROR); | ||
this.log(logObject, interfaces_1.LogLevels.ERROR); | ||
this.log("ERROR: " + message, interfaces_1.LogLevels.ERROR, this.color.error); | ||
this.log(logObject, interfaces_1.LogLevels.ERROR, this.color.error); | ||
}; | ||
@@ -74,4 +82,4 @@ /** | ||
if (message === void 0) { message = ''; } | ||
this.log("FATAL: " + message, interfaces_1.LogLevels.FATAL); | ||
this.log(logObject, interfaces_1.LogLevels.FATAL); | ||
this.log("FATAL: " + message, interfaces_1.LogLevels.FATAL, this.color.fatal); | ||
this.log(logObject, interfaces_1.LogLevels.FATAL, this.color.fatal); | ||
}; | ||
@@ -78,0 +86,0 @@ return Logger; |
import { ILogger, LogLevels } from '../interfaces/interfaces'; | ||
export default class Logger implements ILogger { | ||
level: LogLevels; | ||
private color; | ||
private log; | ||
@@ -5,0 +6,0 @@ /** |
{ | ||
"name": "@icreate/core", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "Ics核心包封装", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153734
1906