Skip to content

Conversation

@NeoSelf1
Copy link
Contributor

@NeoSelf1 NeoSelf1 commented Mar 2, 2025

✅ 작업 사항

  • LogKit 패키지 새로 구현
  • BookMatchLogger, NetworkEventLogger, DSLogger 등 기타 패키지에서 별도로 생성되어 호출되던 OSLog 인스턴스 일괄 제거
  • LogKit import하여 LogKit 패키지의 출력 메서드로 일괄 통일
  • SubSystem, Category에 대한 열거형 정의 및 메서드에 사용
  • 간편한 호출방식을 위한 Facade 계층 새로 추가

👉 리뷰 포인트

스크린샷 2025-03-02 오후 2 16 33
스크린샷 2025-03-02 오후 2 16 26
스크린샷 2025-03-02 오후 2 16 19
스크린샷 2025-03-02 오후 2 16 01
스크린샷 2025-03-02 오후 2 18 15

- MemoryStorage -> MemoryStorageActor로 변경하여 내부 메서드가 직렬화 실행될 수 있도록 보장
- NSLock 객체 제거
- 복잡한 내부 동작 감추고, 단순한 외부 인터페이스만을 제공
/// static 프로퍼티 및 메서드는 인스턴스와 무관하게 타입 자체에 속하기에 actor의 격리 메커니즘 밖에 존재하여, actor-isolation 제약을 받지 않게
/// 됨.
private static let loggers: [LoggerKey: Logger] = {
var map: [LoggerKey: Logger] = [:]
Copy link
Contributor

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] = {
Copy link
Contributor

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 {
Copy link
Contributor

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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public 선언이 안 되어 있는 듯 합니당

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

인터널로 사용할 계획이셨군요~ 짱짱입니다!

/// 단순히 전역 액터 속성만 정의
/// 단순히 전역 액터 속성만 정의하는 것이 아니라, 로깅 인터페이스도 제공
@globalActor
public actor LogKitActor {
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

퍼사드 패턴에 대해 알아갑니다! 감사합니다~!

Copy link
Contributor

@ericKwon95 ericKwon95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로그가 꽤 많았을텐데,, 전부 고치느라 고생 많으셨습니다!!

- LogEngine으로 이름 변경
- 주석 작성
- 싱글턴 인스턴스가 사용되기 전에는 초기화되지 않기 때문에 앱 시작 시간이라는 보장이 없어 logStartTime으로 네이밍 변경
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants