Skip to content

Problem with printing Logging and build dynamic Framework from source code #1015

@maiquannguyen

Description

@maiquannguyen

1. Logging wont write to file when not in debug mode, and should not using print for log
The logging function wont work when scheme not in debug mode, both from write log to file and print the message to console.
I understand that should not print log to console when not in debug mode, but instead of using debugPrint, in Log file the code was like this

func print(_ object: Any) {
    // Only allowing in DEBUG mode
    #if DEBUG
    Swift.print(object)
    #endif
}

Also the function for check if logging enable isLoggingEnabled, always return false when it is not in Debug.

private class func isLoggingEnabled(for currentLevel: LogLevel) -> Bool {
        #if !(DEBUG)
        return false
        #endif
        
        if currentLevel.rawValue < Log.logLevel.rawValue {
            return false
        }
        
        return true
    }

It will block write log to file, it should not have check for DEBUG, if using debugPrint function instead of print.

2. The xcframework build command guide from readme file is not really working
The current command for archive simulator framework only work on simulator on macbook with intel chip, it not work on macbook which run m1 chip.

xcodebuild archive \
	only_active_arch=NO \
	defines_module=YES \
	SKIP_INSTALL=NO \
	-workspace PrebidMobile.xcworkspace \
	-scheme "${schemes[$n]}" \
	-configuration Release \
	-arch x86_64 \
	-sdk "iphonesimulator" \
	-derivedDataPath $XCODE_BUILD_DIR \
	-archivePath "$XCODE_ARCHIVE_DIR/${schemes[$n]}$POSTFIX_SIMULATOR.xcarchive" \

Because the arch is x86_64, now m1 macbook simulator already run with arm architecture chip.
It should be update like this

xcodebuild archive \
	only_active_arch=NO \
	defines_module=YES \
	SKIP_INSTALL=NO \
	-workspace PrebidMobile.xcworkspace \
	-scheme "${schemes[$n]}" \
	-configuration Release \
	-destination 'generic/platform=iOS Simulator' \
	-derivedDataPath $XCODE_BUILD_DIR \
	-archivePath "$XCODE_ARCHIVE_DIR/${schemes[$n]}$POSTFIX_SIMULATOR.xcarchive" \

So it can run on both Macbook with intel chip and Apple chip simulators.

***May i suggest a PR for this ? ***

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Triage

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions