-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add ios session replay to react-native example app
- Loading branch information
Showing
12 changed files
with
1,722 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1 @@ | ||
# This `.xcode.env` file is versioned and is used to source the environment | ||
# used when running script phases inside Xcode. | ||
# To customize your local environment, you can create an `.xcode.env.local` | ||
# file that is not versioned. | ||
|
||
# NODE_BINARY variable contains the PATH to the node executable. | ||
# | ||
# Customize the NODE_BINARY variable here. | ||
# For example, to use nvm with brew, add the following line | ||
# . "$(brew --prefix nvm)/nvm.sh" --no-use | ||
export NODE_BINARY=$(command -v node) | ||
export NODE_BINARY=/Users/curtis/.nvm/versions/node/v18.20.4/bin/node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// ConsoleLogger.swift | ||
// | ||
// | ||
// Created by Marvin Liu on 10/28/22. | ||
// | ||
|
||
import Foundation | ||
import os.log | ||
import AmplitudeSessionReplay | ||
|
||
|
||
@objc(AMPLogLevel) | ||
public enum LogLevelEnum: Int { | ||
case OFF | ||
case ERROR | ||
case WARN | ||
case LOG | ||
case DEBUG | ||
} | ||
|
||
public class ConsoleLogger: AmplitudeSessionReplay.Logger { | ||
public typealias LogLevel = LogLevelEnum | ||
|
||
public var logLevel: Int | ||
private var logger: OSLog | ||
|
||
public init(logLevel: Int = LogLevelEnum.OFF.rawValue) { | ||
self.logLevel = logLevel | ||
self.logger = OSLog(subsystem: "Amplitude", category: "Logging") | ||
} | ||
|
||
public func error(message: String) { | ||
if logLevel >= LogLevel.ERROR.rawValue { | ||
os_log("Error: %@", log: logger, type: .error, message) | ||
} | ||
} | ||
|
||
public func warn(message: String) { | ||
if logLevel >= LogLevel.WARN.rawValue { | ||
os_log("Warn: %@", log: logger, type: .default, message) | ||
} | ||
} | ||
|
||
public func log(message: String) { | ||
if logLevel >= LogLevel.LOG.rawValue { | ||
os_log("Log: %@", log: logger, type: .info, message) | ||
} | ||
} | ||
|
||
public func debug(message: String) { | ||
if logLevel >= LogLevel.DEBUG.rawValue { | ||
os_log("Debug: %@", log: logger, type: .debug, message) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.