LogUtil日志默认改为关闭OFF

Signed-off-by: zenggaofeng <zenggaofeng2@h-partners.com>
This commit is contained in:
zenggaofeng 2024-04-12 10:28:56 +08:00 committed by Madi
parent 9fd6963a8e
commit 2a66bdbbba
8 changed files with 31 additions and 3 deletions

View File

@ -18,6 +18,7 @@
- 支持生命周期已销毁的图片,不再发起请求
待实现特性
- svg图片显示
- gif/webp动图显示与控制
- 内存降采样优化,节约内存的占用
- 支持自定义图片加载

View File

@ -17,7 +17,7 @@ import hilog from '@ohos.hilog';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
import window from '@ohos.window';
import { ImageKnife } from '@ohos/imageknife';
import { ImageKnife,LogUtil } from '@ohos/imageknife';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
@ -34,7 +34,7 @@ export default class EntryAbility extends UIAbility {
// 初始化ImageKnife的文件缓存
await ImageKnife.getInstance().initFileCache(this.context, 256, 256 * 1024 * 1024)
LogUtil.mLogLevel = LogUtil.ALL
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');

View File

@ -46,6 +46,7 @@
},
{
"name": "ohos.permission.MEDIA_LOCATION",
"reason":"$string:app_permission_MEDIA_LOCATION",
"usedScene": {
"abilities": [
"EntryAbility"
@ -55,6 +56,7 @@
},
{
"name": "ohos.permission.READ_MEDIA",
"reason": "$string:app_permission_MEDIA_LOCATION",
"usedScene": {
"abilities": [
"EntryAbility"

View File

@ -11,6 +11,14 @@
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "app_permission_MEDIA_LOCATION",
"value": "获取媒体图片"
},
{
"name": "app_permission_READ_MEDIA",
"value": "读媒体图片"
}
]
}

View File

@ -11,6 +11,14 @@
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "app_permission_MEDIA_LOCATION",
"value": "获取媒体图片"
},
{
"name": "app_permission_READ_MEDIA",
"value": "读媒体图片"
}
]
}

View File

@ -11,6 +11,14 @@
{
"name": "EntryAbility_label",
"value": "label"
},
{
"name": "app_permission_MEDIA_LOCATION",
"value": "获取媒体图片"
},
{
"name": "app_permission_READ_MEDIA",
"value": "读媒体图片"
}
]
}

View File

@ -8,4 +8,5 @@ export { ImageKnifeRequest } from './src/main/ets/ImageKnifeRequest'
export { FileUtils } from './src/main/ets/utils/FileUtils'
export { LogUtil } from './src/main/ets/utils/LogUtil'

View File

@ -20,7 +20,7 @@ export class LogUtil {
public static WARN: number = 5
public static ERROR: number = 6
public static ALL: number = 7
public static mLogLevel: number = LogUtil.ALL;
public static mLogLevel: number = LogUtil.OFF;
public static TAG: string = "ImageKnife:: ";
public static debug(message: string, ...args: Object[]) {