Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta

This commit is contained in:
Ilya Laktyushin
2025-12-06 02:17:48 +04:00
commit 8344b97e03
28070 changed files with 7995182 additions and 0 deletions
+24
View 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",
],
)
+33
View File
@@ -0,0 +1,33 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "NetworkLogging",
platforms: [.macOS(.v10_13)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "NetworkLogging",
targets: ["NetworkLogging"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "MtProtoKit", path: "../MtProtoKit")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "NetworkLogging",
dependencies: [.product(name: "MtProtoKit", package: "MtProtoKit", condition: nil)],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders")
]),
]
)
@@ -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
@@ -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) {
if (bridgingTrace) {
bridgingTrace(@"MT", format);
}
}
static void TGTelegramShortLoggingFunction(NSString *format) {
if (bridgingShortTrace) {
bridgingShortTrace(@"MT", format);
}
}
void NetworkRegisterLoggingFunction() {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
MTLogSetLoggingFunction(&TGTelegramLoggingFunction);
MTLogSetShortLoggingFunction(&TGTelegramShortLoggingFunction);
});
}
void NetworkSetLoggingEnabled(bool value) {
MTLogSetEnabled(value);
}