Showing posts with label log. Show all posts
Showing posts with label log. Show all posts

2015/12/03

SVN 서버에 log 없이 Commit 할 수 없도록 설정하기

Visual SVN을 사용하고 있는데 사용자들로 하여금 Commit 할 때 Log 메시지를 필수로 넣게하고자 방법을 찾아 보았다.
SVN 서버 설정에는 Commit 관련하여 hook 라는 여러가지 이벤트를 처리할 수 있는 방법이 있다.

Visual SVN 의 Repository 의 Property를 보면 Hooks 탭을 볼 수있는데 이 탭에서 여러가지 Event에 대한 설정을 할 수 있다.
Commit 관련하여 시작할 때와 파일을 올리고 Commit 하기 직전 그리고 Commit을 완료한 시점에 대한 hook를 설정할 수 있다.
start-commit
run before commit transaction begins, can be used to do special permission checking
pre-commit
run at the end of the transaction, but before commit. Often used to validate things such as a non zero length log message.
post-commit
runs after the transaction has been committed. Can be used for sending emails, or backing up repository.
- 출처 : Stack Overflow

pre-commit hook에 Windows 배치스크립트를 작성하여 검사할 수 있으며 이 스크립트가 0이 아닌 에러코드를 넘길 경우 Commit이 취소 된다.

아래 코드는 Stack Overflow에서 얻은 로그를 6자 이상 넣도록 하는 배치코드 이다.
setlocal enabledelayedexpansion

set REPOS=%1
set TXN=%2

set SVNLOOK="%VISUALSVN_SERVER%\bin\svnlook.exe"

SET M=

REM Concatenate all the lines in the commit message
FOR /F "usebackq delims==" %%g IN (`%SVNLOOK% log -t %TXN% %REPOS%`) DO SET M=!M!%%g

REM Make sure M is defined
SET M=0%M%

REM Here the 6 is the length we require
IF NOT "%M:~6,1%"=="" goto NORMAL_EXIT

:ERROR_TOO_SHORT
echo "Commit note must be at least 6 letters" >&2
goto ERROR_EXIT

:ERROR_EXIT
exit /b 1

REM All checks passed, so allow the commit.
:NORMAL_EXIT
exit 0

2010/03/28

[Study Note] 디버그 로그 뿌리고 확인하기

Eclipse를 이용한 안드로이드의 개발에도 Visual C++ 에서의 TRACE 기능이 있다. android.util.Log 가 그 기능을 한다.



아래는 Log 클래스를 이용한 디버그 메세지 출력 예이다.

import android.util.Log;

public void onClick( View v )
{
Log.d("DEBUG", "testmsg - Onclick");
Log.e("ERROR", "testmsg - Onclick");
Log.i("INFO", "testmsg - Onclick");
Log.v("VERBOSE", "testmsg - Onclick");
Log.w("WARN", "testmsg - Onclick");
}




위와 같이 로그 메세지를 뿌리면 아래와 같이 LogCat 창에서 확인을 수 있다. 로그의 종류별로 색상을 다르게 출력을 해 주어 한 눈에 확인할 수 있다.



LogCat 창은 Window 메뉴의 Open Perspective 의 Debug 를 선택하면 볼 수 있다.




또는 현재 작업 화면에서 LogCat을 추가할 수 있는데 Window 메뉴의 Show View 의 Other... 를 선택하고,



Android 항목 아래에 있는 LogCat 을 선택하면 LogCat를 현재의 작업 환경에 추가할 수 있다.


Android 개발 문서의 Log에 대한 설명<

Original Post : http://neodreamer-dev.tistory.com/394