xugenyuan

ref |> log转换Logger

Showing 19 changed files with 61 additions and 48 deletions
... ... @@ -7,5 +7,6 @@
"license": "Apache-2.0",
"packageType": "InterfaceHar",
"dependencies": {
"wdKit": "file:../wdKit"
}
}
\ No newline at end of file
... ...
... ... @@ -9,6 +9,7 @@ import { uniformTypeDescriptor as utd } from '@kit.ArkData';
import { JSON } from '@kit.ArkTS';
import { image } from '@kit.ImageKit';
import { WDShareBase } from '../WDShareBase';
import { Logger } from 'wdKit';
const TAG = "WDSystemShare"
... ... @@ -32,9 +33,9 @@ export class WDSystemShare implements WDShareInterface {
selectionMode: systemShare.SelectionMode.SINGLE
});
console.log(TAG, "分享控制器调用完成")
Logger.debug(TAG, "分享控制器调用完成")
} catch (e) {
console.log(TAG, "异常1" + JSON.stringify(e))
Logger.error(TAG, "异常1" + JSON.stringify(e))
fail(e)
}
})
... ... @@ -45,7 +46,7 @@ export class WDSystemShare implements WDShareInterface {
if (contentType === ShareContentType.PrueText) {
let prueText = content as ShareContentText
console.log(TAG, "分享纯文本")
Logger.debug(TAG, "分享纯文本")
resolve(new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: prueText.text
... ... @@ -55,7 +56,7 @@ export class WDSystemShare implements WDShareInterface {
if (contentType === ShareContentType.ImageAndText) {
let imageAndText = content as ShareContentImageAndText
console.log(TAG, "分享图片和文本")
Logger.debug(TAG, "分享图片和文本")
let data: systemShare.SharedData = new systemShare.SharedData({
utd: utd.UniformDataType.PLAIN_TEXT,
content: imageAndText.title
... ... @@ -68,11 +69,11 @@ export class WDSystemShare implements WDShareInterface {
return
}
console.log(TAG, "分享链接和文本")
Logger.debug(TAG, "分享链接和文本")
let link = content as ShareContentLink
let posterImg: Uint8Array | undefined = undefined
let shareLink = this.generateShareLink(link)
console.log("TAG, 分享 shareLink ==> " + shareLink)
Logger.debug("TAG, 分享 shareLink ==> " + shareLink)
if (!context || !link.posterImg) {
let data: systemShare.SharedData = new systemShare.SharedData({
... ... @@ -100,7 +101,7 @@ export class WDSystemShare implements WDShareInterface {
resolve(data)
})
.catch((e: Error) => {
console.log(TAG, "异常" + JSON.stringify(e))
Logger.error(TAG, "异常" + JSON.stringify(e))
fail(e)
})
})
... ...
... ... @@ -663,7 +663,7 @@ export struct DynamicDetailComponent {
styleType: 1,
onCommentIconClick:()=>{
const info = componentUtils.getRectangleById('comment');
console.log(JSON.stringify(info))
Logger.debug(TAG, JSON.stringify(info))
if (!this.offsetY) {
this.offsetY = componentUtils.getRectangleById('comment').windowOffset.y
... ... @@ -861,7 +861,7 @@ export struct DynamicDetailComponent {
this.newsStatusOfUser = data[0];
// Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
Logger.error(TAG, JSON.stringify(exception))
}
}
... ...
... ... @@ -360,7 +360,7 @@ export struct ImageAndTextPageComponent {
this.getRecommend()
}
if (this.contentDetailData?.openLikes === 1) {
console.log(TAG, '点赞this.getInteractDataStatus()')
Logger.debug(TAG, '点赞this.getInteractDataStatus()')
this.getInteractDataStatus()
this.queryContentInteractCount()
}
... ... @@ -425,11 +425,11 @@ export struct ImageAndTextPageComponent {
}
// console.log(TAG,'contentDetailData', JSON.stringify(params.contentList))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.log(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
Logger.debug(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.newsStatusOfUser = data[0];
// console.log(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG,'exception', JSON.stringify(exception))
Logger.debug(TAG,'exception', JSON.stringify(exception))
}
}
... ...
... ... @@ -18,6 +18,8 @@ import { InfomationCardClick } from '../../utils/infomationCardClick'
import measure from '@ohos.measure'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
const TAG = "RmhTitle"
@Component
export struct RmhTitle {
@State compDTO: CompDTO = new CompDTO()
... ... @@ -57,7 +59,7 @@ export struct RmhTitle {
status: this.followStatus == '0' ? 1 : 0,
}
ContentDetailRequest.postInteractAccentionOperate(params2).then(res => {
console.log('rmhTitle-data', JSON.stringify(res.data))
Logger.debug(TAG, 'rmhTitle-data' + JSON.stringify(res.data))
InfomationCardClick.track(
this.compDTO,
... ... @@ -74,7 +76,7 @@ export struct RmhTitle {
this.followStatus = '1'
// 弹窗样式与何时调用待确认
ContentDetailRequest.postPointLevelOperate({ operateType: 6 }).then((res) => {
console.log('关注号主获取积分==', JSON.stringify(res.data))
Logger.debug(TAG, '关注号主获取积分==', JSON.stringify(res.data))
if (res.data?.showToast) {
// ToastUtils.showToast(res.data.ruleName + '+' + res.data.rulePoint + '积分', 1000);
}
... ...
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource,
Logger,
PublicDialogManager,
StringUtils } from 'wdKit/Index';
import { CommentItemCustomType, commentItemModel, WDPublicUserType } from '../model/CommentModel';
... ... @@ -325,8 +326,9 @@ export struct CommentComponent {
,this.publishCommentModel.targetType
,this.firstPageHotIds)
.then(commentListModel => {
console.log('评论:', JSON.stringify(commentListModel.list))
Logger.debugOptimize('Comment', () => {
return '评论:' + JSON.stringify(commentListModel.list)
})
if (pageIndex == 1) {
// 保存第一页热门评论ids
if (commentListModel.hotIds.length > 0) {
... ...
... ... @@ -160,7 +160,7 @@ export struct CommentCustomDialog {
// this.textInputController.stopEditing()
inputMethod.getController().hideTextInput((err: BusinessError) => {
if (err) {
console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`);
Logger.error(TAG, (`Failed to hideTextInput: ${JSON.stringify(err)}`);
return;
}
// console.log('Succeeded in hiding text input.');
... ... @@ -188,7 +188,7 @@ export struct CommentCustomDialog {
// this.textInputController.stopEditing()
inputMethod.getController().hideTextInput((err: BusinessError) => {
if (err) {
console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`);
Logger.debug(TAG, `Failed to hideTextInput: ${JSON.stringify(err)}`);
return;
}
// console.log('Succeeded in hiding text input.');
... ...
import router from '@ohos.router'
import { Params } from 'wdBean';
import { DateTimeUtils, NetworkUtil, NumberFormatterUtils, StringUtils } from 'wdKit';
import { DateTimeUtils, Logger, NetworkUtil, NumberFormatterUtils, StringUtils } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { TrackingPageBrowse, TrackConstants, ParamType, Tracking } from 'wdTracking/Index';
import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent';
... ... @@ -422,7 +422,7 @@ struct OtherNormalUserHomePage {
}
this.getUserLevel()
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
Logger.error(TAG, JSON.stringify(err))
})
}
getUserLevel(){
... ... @@ -440,7 +440,7 @@ struct OtherNormalUserHomePage {
this.levelId = value[0].level
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
Logger.error(TAG,JSON.stringify(err))
})
}
... ...
... ... @@ -2,7 +2,7 @@ import { Params } from 'wdBean/Index';
import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
import { router } from '@kit.ArkUI';
import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem';
import { LazyDataSource, SPHelper, StringUtils } from 'wdKit/Index';
import { LazyDataSource, Logger, SPHelper, StringUtils } from 'wdKit/Index';
import SearcherAboutDataModel from '../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem';
... ... @@ -133,7 +133,7 @@ struct SearchCreatorPage {
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
Logger.error(TAG,"请求失败" + JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
})
... ... @@ -190,7 +190,7 @@ struct SearchCreatorPage {
.layoutWeight(1)
.scrollBar(BarState.Off)
.onReachEnd(()=>{
console.log(TAG,"触底了");
Logger.debug(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
... ...
import { TAG } from '@ohos/hypium/src/main/Constant';
import { ContentDTO } from 'wdBean/Index';
import { SpConstants } from 'wdConstant/Index'
import { DateTimeUtils, LazyDataSource, NetworkUtil, SPHelper, StringUtils} from 'wdKit/Index'
import { DateTimeUtils, LazyDataSource, Logger, NetworkUtil, SPHelper, StringUtils} from 'wdKit/Index'
import { ProcessUtils } from 'wdRouter/Index';
import { VisitorCommentComponent } from '../components/mine/home/VisitorCommentComponent';
import { CustomPullToRefresh } from '../components/reusable/CustomPullToRefresh';
... ... @@ -176,7 +176,7 @@ struct VisitorCommentPage {
this.isGetRequest = true
this.isLoading = false
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
Logger.error(TAG, "get " + JSON.stringify(err))
this.isGetRequest = true
this.isLoading = false
})
... ...
import { TrackingContent, TrackConstants, ParamType } from 'wdTracking';
import { CompDTO, ContentDTO } from 'wdBean';
import { Logger } from 'wdKit';
export class InfomationCardClick {
... ... @@ -95,7 +96,7 @@ export class InfomationCardClick {
} else if (contentDTO.source) {
extParams['saAuthorName'] = contentDTO.source;
}
console.log('InfomationCardClick-params:', JSON.stringify(extParams))
Logger.debug('InfomationCardClick-params:', JSON.stringify(extParams))
if (action === 'detailPageShow') {
TrackingContent.common(TrackConstants.EventType.Click, pageId, pageName, extParams);
} else if (action === 'like') {
... ... @@ -106,7 +107,7 @@ export class InfomationCardClick {
TrackingContent.follow(bl, followUserId, followUserName, pageId, pageName, extParams)
}
} catch (err) {
console.log('InfomationCardClick-err', JSON.stringify(err))
Logger.error('InfomationCardClick-err', JSON.stringify(err))
}
}
}
\ No newline at end of file
... ...
import { Logger } from "wdKit";
export interface textItem {
content: string,
isRed: boolean
... ... @@ -8,6 +10,8 @@ export interface titleInitRes {
textArr: textItem[]
}
const TAG = "SearchShowRed"
export class SearchShowRed {
// title: this.contentDTO.title
static titleInit(title: string) {
... ... @@ -27,7 +31,9 @@ export class SearchShowRed {
res.push(content);
}
console.log('SearchShowRed-res', JSON.stringify(res))
Logger.debugOptimize(TAG, () => {
return 'SearchShowRed-res' + JSON.stringify(res)
})
SearchShowRed.formatTitle(
html.replaceAll('<em>', '').replaceAll('</em>', ''),
... ... @@ -41,7 +47,9 @@ export class SearchShowRed {
titleMarked,
textArr
}
console.log('SearchShowRed-titleInitRes', JSON.stringify(titleInitRes))
Logger.debugOptimize(TAG, () => {
return 'SearchShowRed-titleInitRes ' + JSON.stringify(titleInitRes)
})
return titleInitRes
}
... ...
import { Logger } from 'wdKit';
import { HttpUtils } from 'wdNetwork/Index';
export interface mournsInfoModel{
... ... @@ -80,7 +81,7 @@ export class GrayManageModel {
this.videoList = mourns.videoList
this.serverList = mourns.serverList
this.grayUserList = mourns.greyUserList
console.log(TAG, 'LaunchDataModel.mourns', JSON.stringify(mourns))
Logger.debug(TAG, 'LaunchDataModel.mourns', JSON.stringify(mourns))
}
// 国殇模式开启
... ...
... ... @@ -118,7 +118,7 @@ export class LiveModel {
fail(data.message)
return
}
console.log('LiveLikeComponent data.data', data.data)
Logger.debug(TAG, 'LiveLikeComponent data.data ' + data.data)
success(data.data)
}, (error: Error) => {
fail(error.message)
... ...
... ... @@ -157,7 +157,7 @@ export class WDAliPlayerController {
if (this.pageParam) {
console.log('播放视频pageParam', JSON.stringify(this.pageParam))
Logger.debug(TAG, '播放视频pageParam', JSON.stringify(this.pageParam))
// 播放埋点
TrackingPlay.videoPositivePlay(Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000),
this.pageName, this.pageName, this.pageParam)
... ... @@ -172,7 +172,7 @@ export class WDAliPlayerController {
if (this.pageParam) {
let initDuration = Math.floor(Number(this.duration) / 1000)
let currentPlayTime: number = Math.floor((DateTimeUtils.getTimeStamp() - this.creatStartTime) / 1000) //当前播放时间
console.log('播放结束')
Logger.debug(TAG, '播放结束')
// 播放结束埋点
TrackingPlay.videoPlayEnd(currentPlayTime, initDuration, currentPlayTime, this.pageName, this.pageName,
this.pageParam)
... ... @@ -279,7 +279,7 @@ export class WDAliPlayerController {
this.status = PlayerConstants.STATUS_ERROR;
this.watchStatus();
console.log('播放错误',JSON.stringify(error))
Logger.error(TAG, '播放错误',JSON.stringify(error))
TrackingPlay.videoPlayError(errorInfo.getMsg(), this.pageName, this.pageName, this.pageParam)
}
});
... ...
import componentUtils from '@ohos.arkui.componentUtils';
import { WDPlayerController } from '../controller/WDPlayerController'
import { WindowModel } from 'wdKit';
import { Logger } from '../utils/Logger';
import { WindowModel, Logger } from 'wdKit';
import { enableAliPlayer } from '../utils/GlobalSetting';
import { WDAliPlayerController } from '../controller/WDAliPlayerController';
... ... @@ -24,11 +23,11 @@ class MGPlayRenderViewIns {
static add() {
MGPlayRenderViewIns.intCount++;
WindowModel.shared.setWindowKeepScreenOn(true);
console.log("add-- +1")
Logger.debug(TAG, "add-- +1")
}
static del() {
console.log("del-- -1")
Logger.debug(TAG, "del-- -1")
MGPlayRenderViewIns.intCount--;
if (MGPlayRenderViewIns.intCount <= 0) {
WindowModel.shared.setWindowKeepScreenOn(false);
... ...
import componentUtils from '@ohos.arkui.componentUtils';
import { WindowModel } from 'wdKit';
import { Logger } from '../utils/Logger';
import { WindowModel, Logger } from 'wdKit';
import { enableAliPlayer } from '../utils/GlobalSetting';
import { WDAliPlayerController } from '../controller/WDAliPlayerController';
... ... @@ -23,11 +22,11 @@ class MGPlayRenderViewIns {
static add() {
MGPlayRenderViewIns.intCount++;
WindowModel.shared.setWindowKeepScreenOn(true);
console.log("add-- +1")
Logger.debug(TAG, "add-- +1")
}
static del() {
console.log("del-- -1")
Logger.debug(TAG, "del-- -1")
MGPlayRenderViewIns.intCount--;
if (MGPlayRenderViewIns.intCount <= 0) {
WindowModel.shared.setWindowKeepScreenOn(false);
... ...
... ... @@ -24,11 +24,11 @@ class MGPlayRenderViewIns {
static add() {
MGPlayRenderViewIns.intCount++;
WindowModel.shared.setWindowKeepScreenOn(true);
console.log("add-- +1")
Logger.debug(TAG, "add-- +1")
}
static del() {
console.log("del-- -1")
Logger.debug(TAG, "del-- -1")
MGPlayRenderViewIns.intCount--;
if (MGPlayRenderViewIns.intCount <= 0) {
WindowModel.shared.setWindowKeepScreenOn(false);
... ...
... ... @@ -24,11 +24,11 @@ class MGPlayRenderViewIns {
static add() {
MGPlayRenderViewIns.intCount++;
WindowModel.shared.setWindowKeepScreenOn(true);
console.log("add-- +1")
Logger.debug(TAG, "add-- +1")
}
static del() {
console.log("del-- -1")
Logger.debug(TAG, "del-- -1")
MGPlayRenderViewIns.intCount--;
if (MGPlayRenderViewIns.intCount <= 0) {
WindowModel.shared.setWindowKeepScreenOn(false);
... ... @@ -66,7 +66,6 @@ export struct WDPlayerRenderView {
}
this.playerController.onVideoSizeChange = (width: number, height: number) => {
console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`)
Logger.info(TAG, ` onVideoSizeChange width:${width} height:${height}`)
this.videoWidth = width;
this.videoHeight = height;
... ...