Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logging format for OnNewAddress #27

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kenhys
Copy link
Contributor

@kenhys kenhys commented Jan 26, 2023

Which issue(s) this PR fixes:

N/A

What this PR does / why we need it:

OnNewAddressEnter, OnNewAddress events should be logged with a tab as a separator for Chronos_trace.log

Before:

TIMESTAMP\tTYPE\tHANDLE EVENT:MESSAGE

After:

TIMESTAMP\tTYPE\tHANDLE\tEVENT\tMESSAGE

How to verify the fixed issue:

  1. Launch Chronos.exe
  2. Type any URL in addressbar

Expected result:

The logging message should be seperated with tab.

2023-01-26 11:46:45	AC	BF_WND:0x000507a8	OnNewAddressEnter	https://google.co.jp

It should use tab as separator for Chronos_trace.log

Before:
  TIMESTAMP\tTYPE\tHANDLE EVENT:MESSAGE

After:
  TIMESTAMP\tTYPE\tHANDLE\tEVENT\tMESSAGE

Signed-off-by: Kentaro Hayashi <[email protected]>
@ashie
Copy link
Member

ashie commented Jan 26, 2023

事情をよく分かってないのですが、他のログがタブ区切りだから揃えようとしている、と理解しました。
が、私がぱっと見た限りではタブ区切りのところは見つからなくて、逆にスペース区切りのものしか見つかりませんでした。

例)

logmsg.Format(_T("BF_WND:0x%08x OnFavoliteAddSendMsg CreateProcess Failed"), theApp.SafeWnd(this->m_hWnd));

@kenhys kenhys marked this pull request as draft January 26, 2023 03:18
@kenhys
Copy link
Contributor Author

kenhys commented Jan 26, 2023

他のところもDebugWndLogData dwLogData;を使って統一すべきなんだと思います。
https://github.com/ThinBridge/Chronos/blob/master/DlgDebugWnd.h

いったんDraftに戻します。

@HashidaTKS
Copy link
Contributor

メモ: 画面のデバッグトレースウィンドウにログ出力する場合はAppendDebugViewLogにDebugWndLogDataで作ったデータを渡して出力している。
たいていの場合、同時にDebugWndLogDataのデータをログファイルにも出力している。

例:

	DebugWndLogData dwLogData;
	dwLogData.mHWND.Format(_T("CV_WND:0x%08p"), theApp.SafeWnd(this->m_hWnd));
	dwLogData.mFUNCTION_NAME = _T("OnBeforeResourceLoad");
	dwLogData.mMESSAGE1 = strURL;
	theApp.AppendDebugViewLog(dwLogData);
	CString logmsg = dwLogData.GetString();
	theApp.WriteDebugTraceDateTime(logmsg, DEBUG_LOG_TYPE_URL);

この時、dwLogDataから作られた文字列データは区切り文字にタブを使っている。

他方で、ログファイルにしか出力しないときは、多くの場所で自分で文字列を組み立てていて

		logmsg.Format(_T("BF_WND:0x%08x OnNewAddressEnter %s"), theApp.SafeWnd(this->m_hWnd), str);

のように空白区切りでログを作成している。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants