forked from floraachy/ImageKnife
修改使用hilog记录日志,默认打开debug级别的日志,增加可维侧性
Signed-off-by: Madixin <madixin@huawei.com>
This commit is contained in:
parent
6612dea1d5
commit
47c178fe1f
|
@ -1,6 +1,7 @@
|
||||||
## 3.1.0-rc.3
|
## 3.1.0-rc.3
|
||||||
- 部分静态webp图片有delay属性导致识别成动图,改用getFrameCount识别
|
- 部分静态webp图片有delay属性导致识别成动图,改用getFrameCount识别
|
||||||
- 修复加载错误图后未去请求排队队列中的请求
|
- 修复加载错误图后未去请求排队队列中的请求
|
||||||
|
- 修改使用hilog记录日志,默认打开debug级别的日志
|
||||||
|
|
||||||
## 3.1.0-rc.2
|
## 3.1.0-rc.2
|
||||||
- 修复宽高不等svg图片显示有毛边
|
- 修复宽高不等svg图片显示有毛边
|
||||||
|
|
|
@ -47,7 +47,6 @@ export default class EntryAbility extends UIAbility {
|
||||||
|
|
||||||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
|
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
|
||||||
|
|
||||||
LogUtil.mLogLevel = LogUtil.ALL
|
|
||||||
// 初始化ImageKnife的文件缓存
|
// 初始化ImageKnife的文件缓存
|
||||||
await InitImageKnife.init(this.context)
|
await InitImageKnife.init(this.context)
|
||||||
ImageKnife.getInstance().setEngineKeyImpl(new CustomEngineKeyImpl())
|
ImageKnife.getInstance().setEngineKeyImpl(new CustomEngineKeyImpl())
|
||||||
|
|
|
@ -232,18 +232,18 @@ export class FileCache {
|
||||||
}
|
}
|
||||||
else if (value != undefined) {
|
else if (value != undefined) {
|
||||||
this.currentMemory -= value.byteLength
|
this.currentMemory -= value.byteLength
|
||||||
LogUtil.info("FileCache removeMemorySize: " + value.byteLength + " currentMemory:" + this.currentMemory)
|
LogUtil.debug("FileCache removeMemorySize: " + value.byteLength + " currentMemory:" + this.currentMemory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private addMemorySize(value: ArrayBuffer | number): void {
|
private addMemorySize(value: ArrayBuffer | number): void {
|
||||||
if (typeof value == "number") {
|
if (typeof value == "number") {
|
||||||
this.currentMemory += value
|
this.currentMemory += value
|
||||||
LogUtil.info("FileCache addMemorySize: " + value + " currentMemory:" + this.currentMemory)
|
LogUtil.debug("FileCache addMemorySize: " + value + " currentMemory:" + this.currentMemory)
|
||||||
}
|
}
|
||||||
else if (value != undefined) {
|
else if (value != undefined) {
|
||||||
this.currentMemory += value.byteLength
|
this.currentMemory += value.byteLength
|
||||||
LogUtil.info("FileCache addMemorySize: " + value.byteLength + " currentMemory:" + this.currentMemory)
|
LogUtil.debug("FileCache addMemorySize: " + value.byteLength + " currentMemory:" + this.currentMemory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,44 +12,29 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||||
|
|
||||||
export class LogUtil {
|
export class LogUtil {
|
||||||
public static OFF: number = 1
|
public static readonly DOMAIN: number = 0xD002220;
|
||||||
public static LOG: number = 2
|
public static readonly TAG: string = "ImageKnife::";
|
||||||
public static DEBUG: number = 3
|
|
||||||
public static INFO: number = 4
|
|
||||||
public static WARN: number = 5
|
|
||||||
public static ERROR: number = 6
|
|
||||||
public static ALL: number = 7
|
|
||||||
public static mLogLevel: number = LogUtil.OFF;
|
|
||||||
public static TAG: string = "ImageKnife:: ";
|
|
||||||
|
|
||||||
public static debug(message: string, ...args: Object[]) {
|
public static debug(message: string, ...args: Object[]) {
|
||||||
if (LogUtil.mLogLevel >= LogUtil.DEBUG) {
|
hilog.debug(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
console.debug(LogUtil.TAG + message, args)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static info(message: string, ...args: Object[]) {
|
public static info(message: string, ...args: Object[]) {
|
||||||
if (LogUtil.mLogLevel >= LogUtil.INFO) {
|
hilog.info(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
console.info(LogUtil.TAG + message, args)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static log(message: string, ...args: Object[]) {
|
public static log(message: string, ...args: Object[]) {
|
||||||
if (LogUtil.mLogLevel >= LogUtil.LOG) {
|
hilog.debug(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
console.log(LogUtil.TAG + message, args)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static warn(message: string, ...args: Object[]) {
|
public static warn(message: string, ...args: Object[]) {
|
||||||
if (LogUtil.mLogLevel >= LogUtil.WARN) {
|
hilog.warn(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
console.warn(LogUtil.TAG + message, args)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static error(message: string, ...args: Object[]) {
|
public static error(message: string, ...args: Object[]) {
|
||||||
if (LogUtil.mLogLevel >= LogUtil.ERROR) {
|
hilog.error(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
console.error(LogUtil.TAG + message, args)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue