mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Build Postbox, SyncCore, TelegramCore
This commit is contained in:
parent
a7ff727533
commit
a75bd17b6c
83 changed files with 474 additions and 397 deletions
20
submodules/NetworkLogging/BUCK
Normal file
20
submodules/NetworkLogging/BUCK
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
static_library(
|
||||
name = "NetworkLogging",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
headers = glob([
|
||||
"Sources/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/MtProtoKit:MtProtoKit#shared",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
],
|
||||
)
|
||||
24
submodules/NetworkLogging/BUILD
Normal file
24
submodules/NetworkLogging/BUILD
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
objc_library(
|
||||
name = "NetworkLogging",
|
||||
enable_modules = True,
|
||||
module_name = "NetworkLogging",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/MtProtoKit:MtProtoKit",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef Telegram_NetworkLogging_h
|
||||
#define Telegram_NetworkLogging_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
void NetworkRegisterLoggingFunction();
|
||||
void NetworkSetLoggingEnabled(bool);
|
||||
|
||||
void setBridgingTraceFunction(void (*)(NSString *, NSString *));
|
||||
void setBridgingShortTraceFunction(void (*)(NSString *, NSString *));
|
||||
|
||||
#endif
|
||||
38
submodules/NetworkLogging/Sources/NetworkLogging.m
Normal file
38
submodules/NetworkLogging/Sources/NetworkLogging.m
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#import <NetworkLogging/NetworkLogging.h>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <MtProtoKit/MtLogging.h>
|
||||
|
||||
static void (*bridgingTrace)(NSString *, NSString *);
|
||||
void setBridgingTraceFunction(void (*f)(NSString *, NSString *)) {
|
||||
bridgingTrace = f;
|
||||
}
|
||||
|
||||
static void (*bridgingShortTrace)(NSString *, NSString *);
|
||||
void setBridgingShortTraceFunction(void (*f)(NSString *, NSString *)) {
|
||||
bridgingShortTrace = f;
|
||||
}
|
||||
|
||||
static void TGTelegramLoggingFunction(NSString *format, va_list args) {
|
||||
if (bridgingTrace) {
|
||||
bridgingTrace(@"MT", [[NSString alloc] initWithFormat:format arguments:args]);
|
||||
}
|
||||
}
|
||||
|
||||
static void TGTelegramShortLoggingFunction(NSString *format, va_list args) {
|
||||
if (bridgingShortTrace) {
|
||||
bridgingShortTrace(@"MT", [[NSString alloc] initWithFormat:format arguments:args]);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkRegisterLoggingFunction() {
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
MTLogSetLoggingFunction(&TGTelegramLoggingFunction);
|
||||
MTLogSetShortLoggingFunction(&TGTelegramShortLoggingFunction);
|
||||
});
|
||||
}
|
||||
|
||||
void NetworkSetLoggingEnabled(bool value) {
|
||||
MTLogSetEnabled(value);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue