-
Notifications
You must be signed in to change notification settings - Fork 0
[Feature] LogKit 생성 및 로그 출력 방식 일괄 통일 #114
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
base: develop
Are you sure you want to change the base?
Conversation
- MemoryStorage -> MemoryStorageActor로 변경하여 내부 메서드가 직렬화 실행될 수 있도록 보장 - NSLock 객체 제거
- 복잡한 내부 동작 감추고, 단순한 외부 인터페이스만을 제공
| /// static 프로퍼티 및 메서드는 인스턴스와 무관하게 타입 자체에 속하기에 actor의 격리 메커니즘 밖에 존재하여, actor-isolation 제약을 받지 않게 | ||
| /// 됨. | ||
| private static let loggers: [LoggerKey: Logger] = { | ||
| var map: [LoggerKey: Logger] = [:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굉장히 사소한 부분이긴 한데요, map 대신 더 구체적인 변수명을 사용하면 좋지 않을까 생각이 들었습니다!
| /// 각 카테고리에 해당한느 로거 인스턴스를 Actor 속성이 아닌, 정적 속성으로 생성 | ||
| /// static 프로퍼티 및 메서드는 인스턴스와 무관하게 타입 자체에 속하기에 actor의 격리 메커니즘 밖에 존재하여, actor-isolation 제약을 받지 않게 | ||
| /// 됨. | ||
| private static let loggers: [LoggerKey: Logger] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static 변수는 lazy하게 초기화되며 스레드 안전하지 않기 때문에, loggers를 여러 곳에서 동시적으로 호출하지는 않는지 확인이 필요해 보입니다~!
| public static let shared = LogKitActor() | ||
| } | ||
|
|
||
| public final class _LogKit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ 를 쓴 이유가 궁금해요!
|
|
||
| // MARK: - Public Methods | ||
|
|
||
| func log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public 선언이 안 되어 있는 듯 합니당
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인터널로 사용할 계획이셨군요~ 짱짱입니다!
| /// 단순히 전역 액터 속성만 정의 | ||
| /// 단순히 전역 액터 속성만 정의하는 것이 아니라, 로깅 인터페이스도 제공 | ||
| @globalActor | ||
| public actor LogKitActor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FileManager 자체가 thread-safe한 것으로 알고 있는데, actor로 한 번 더 감싸주신 이유가 궁금합니다~!
| @@ -0,0 +1,81 @@ | |||
| public enum LogKit { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
퍼사드 패턴에 대해 알아갑니다! 감사합니다~!
ericKwon95
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로그가 꽤 많았을텐데,, 전부 고치느라 고생 많으셨습니다!!
- LogEngine으로 이름 변경 - 주석 작성 - 싱글턴 인스턴스가 사용되기 전에는 초기화되지 않기 때문에 앱 시작 시간이라는 보장이 없어 logStartTime으로 네이밍 변경
✅ 작업 사항
👉 리뷰 포인트