├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .swiftlint.yml ├── CODE_OF_CONDUCT.md ├── JJSwiftLog.podspec ├── JJSwiftLog.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── jezz.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcshareddata │ └── xcschemes │ │ └── JJSwiftLogCarthage.xcscheme └── xcuserdata │ └── jezz.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── JJSwiftLog.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── JJSwiftLog ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SceneDelegate.swift ├── Source │ ├── Formatter │ │ └── JJFormatterLogANSIColor.swift │ ├── JJConsoleOutput.swift │ ├── JJFileOutput.swift │ ├── JJLogEntity.swift │ ├── JJLogFilter.swift │ ├── JJLogFormatter.swift │ ├── JJLogFormatterProtocol.swift │ ├── JJLogObject.swift │ ├── JJLogOutput+Extension.swift │ ├── JJLogOutput.swift │ ├── JJSentryOutput.swift │ └── JJSwiftLog.swift └── ViewController.swift ├── JJSwiftLogCarthage ├── Info.plist └── JJSwiftLogCarthage.h ├── JJSwiftLogCarthageTests ├── Info.plist └── JJSwiftLogCarthageTests.swift ├── JJSwiftLogPrinciple.md ├── JJSwiftLogTests ├── FormatterTests.swift ├── Info.plist ├── JJSwiftLogTests.swift └── SentryTests.swift ├── LICENSE ├── Package.swift ├── Podfile ├── Podfile.lock ├── README.md ├── README_CN.md ├── screenshots ├── ansicolor.png ├── architecture.png ├── main.png └── pay.jpeg └── updateCocoaPod.sh /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | *.DS_Store 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | 29 | ## App packaging 30 | *.ipa 31 | *.dSYM.zip 32 | *.dSYM 33 | 34 | ## Playgrounds 35 | timeline.xctimeline 36 | playground.xcworkspace 37 | 38 | # Swift Package Manager 39 | # 40 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 41 | # Packages/ 42 | # Package.pins 43 | # Package.resolved 44 | # *.xcodeproj 45 | # 46 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 47 | # hence it is not needed unless you have added a package configuration file to your project 48 | .swiftpm 49 | 50 | .build/ 51 | 52 | # CocoaPods 53 | # 54 | # We recommend against adding the Pods directory to your .gitignore. However 55 | # you should judge for yourself, the pros and cons are mentioned at: 56 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 57 | # 58 | Pods/ 59 | # 60 | # Add this line if you want to avoid checking in source code from the Xcode workspace 61 | # *.xcworkspace 62 | 63 | # Carthage 64 | # 65 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 66 | # Carthage/Checkouts 67 | 68 | Carthage/Build/ 69 | 70 | # Accio dependency management 71 | Dependencies/ 72 | .accio/ 73 | 74 | # fastlane 75 | # 76 | # It is recommended to not store the screenshots in the git repo. 77 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 78 | # For more information about the recommended setup visit: 79 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 80 | 81 | fastlane/report.xml 82 | fastlane/Preview.html 83 | fastlane/screenshots/**/*.png 84 | fastlane/test_output 85 | 86 | # Code Injection 87 | # 88 | # After new code Injection tools there's a generated folder /iOSInjectionProject 89 | # https://github.com/johnno1962/injectionforxcode 90 | 91 | iOSInjectionProject/ 92 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | disabled_rules: # 执行时排除掉的规则 2 | #- colon 3 | #- comma 4 | #- control_statement 5 | - trailing_whitespace 6 | opt_in_rules: # 一些规则仅仅是可选的 7 | - empty_count 8 | - missing_docs 9 | # 可以通过执行如下指令来查找所有可用的规则: 10 | # swiftlint rules 11 | excluded: # 执行 linting 时忽略的路径。 优先级比 `included` 更高。 12 | - Carthage 13 | - Pods 14 | included: 15 | 16 | # 可配置的规则可以通过这个配置文件来自定义 17 | # 二进制规则可以设置他们的严格程度 18 | force_cast: warning # 隐式 19 | force_try: 20 | severity: warning # 显式 21 | # 同时有警告和错误等级的规则,可以只设置它的警告等级 22 | # 隐式 23 | line_length: 200 24 | function_parameter_count: 7 25 | # 可以通过一个数组同时进行隐式设置 26 | type_body_length: 27 | - 300 # warning 28 | - 400 # error 29 | # 或者也可以同时进行显式设置 30 | file_length: 31 | warning: 500 32 | error: 1200 33 | # 命名规则可以设置最小长度和最大程度的警告/错误 34 | # 此外它们也可以设置排除在外的名字 35 | type_name: 36 | min_length: 4 # 只是警告 37 | max_length: # 警告和错误 38 | warning: 40 39 | error: 50 40 | excluded: iPhone # 排除某个名字 41 | variable_name: 42 | min_length: # 只有最小长度 43 | error: 3 # 只有错误 44 | excluded: # 排除某些名字 45 | - id 46 | - URL 47 | - GlobalAPIKey 48 | reporter: "xcode" # 报告类型 (xcode, json, csv, checkstyle) 49 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /JJSwiftLog.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint JJSwiftLog.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'JJSwiftLog' 11 | s.version = "0.1.3" 12 | s.summary = 'High performance swift log module.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | High performance swift log,support customer log. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/jezzmemo/JJSwiftLog' 25 | s.license = { :type => 'MIT', :file => 'LICENSE' } 26 | s.author = { 'Jezz' => 'lijie250@gmail.com' } 27 | s.source = { :git => 'https://github.com/jezzmemo/JJSwiftLog.git', :tag => s.version.to_s } 28 | 29 | s.ios.deployment_target = '9.0' 30 | s.osx.deployment_target = "10.9" 31 | s.watchos.deployment_target = "2.0" 32 | s.tvos.deployment_target = "9.0" 33 | 34 | s.swift_versions = ['4.0','4.2','5.0'] 35 | s.default_subspec = 'Main' 36 | 37 | # s.static_framework = true 38 | 39 | s.subspec 'Main' do |spec| 40 | spec.source_files = 'JJSwiftLog/Source/*.{swift}' 41 | end 42 | 43 | end 44 | -------------------------------------------------------------------------------- /JJSwiftLog.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 25A01DFE5FC8C0BFCEFC9C01 /* Pods_JJSwiftLog.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE62F46789707C0138E386AC /* Pods_JJSwiftLog.framework */; }; 11 | 3E0BA730BF456A5C8DE5E7E9 /* Pods_JJSwiftLogCarthageTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0358C6CA66EF7E629F0A14EE /* Pods_JJSwiftLogCarthageTests.framework */; }; 12 | 53DEB30C57F2B327B5DE4663 /* Pods_JJSwiftLogTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A76452E1943E25864935B817 /* Pods_JJSwiftLogTests.framework */; }; 13 | 610FBB2E2781852B0021BB00 /* JJLogEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 610FBB2D2781852B0021BB00 /* JJLogEntity.swift */; }; 14 | 610FBB302781867A0021BB00 /* JJLogFormatterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 610FBB2F2781867A0021BB00 /* JJLogFormatterProtocol.swift */; }; 15 | 610FBB312782AA4D0021BB00 /* JJLogEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 610FBB2D2781852B0021BB00 /* JJLogEntity.swift */; }; 16 | 610FBB322782AA4D0021BB00 /* JJLogFormatterProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 610FBB2F2781867A0021BB00 /* JJLogFormatterProtocol.swift */; }; 17 | 610FBB3427888CA40021BB00 /* JJLogObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 610FBB3327888CA40021BB00 /* JJLogObject.swift */; }; 18 | 610FBB3527888CA40021BB00 /* JJLogObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 610FBB3327888CA40021BB00 /* JJLogObject.swift */; }; 19 | 612D73A224299C3800EDA133 /* JJLogFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6174B98E23F83AFA00841805 /* JJLogFormatter.swift */; }; 20 | 613A363627B013BC0071C021 /* FormatterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 613A363527B013BC0071C021 /* FormatterTests.swift */; }; 21 | 613A363827B769DA0071C021 /* JJSentryOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 613A363727B769DA0071C021 /* JJSentryOutput.swift */; }; 22 | 613A363A27C244AC0071C021 /* SentryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 613A363927C244AC0071C021 /* SentryTests.swift */; }; 23 | 613BFC94278B220A00F4D77B /* JJLogFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 613BFC93278B220A00F4D77B /* JJLogFilter.swift */; }; 24 | 613BFC95278B220A00F4D77B /* JJLogFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 613BFC93278B220A00F4D77B /* JJLogFilter.swift */; }; 25 | 614D5A8523BA09B0004E7AA2 /* JJSwiftLogCarthage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 614D5A7C23BA09AF004E7AA2 /* JJSwiftLogCarthage.framework */; }; 26 | 614D5A8C23BA09B0004E7AA2 /* JJSwiftLogCarthageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 614D5A8B23BA09B0004E7AA2 /* JJSwiftLogCarthageTests.swift */; }; 27 | 614D5A8E23BA09B0004E7AA2 /* JJSwiftLogCarthage.h in Headers */ = {isa = PBXBuildFile; fileRef = 614D5A7E23BA09AF004E7AA2 /* JJSwiftLogCarthage.h */; settings = {ATTRIBUTES = (Public, ); }; }; 28 | 614D5A9123BA09B0004E7AA2 /* JJSwiftLogCarthage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 614D5A7C23BA09AF004E7AA2 /* JJSwiftLogCarthage.framework */; }; 29 | 614D5A9223BA09B0004E7AA2 /* JJSwiftLogCarthage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 614D5A7C23BA09AF004E7AA2 /* JJSwiftLogCarthage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 30 | 614D5A9A23BA09D3004E7AA2 /* JJSwiftLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534523B609890097C4D9 /* JJSwiftLog.swift */; }; 31 | 614D5A9B23BA09D3004E7AA2 /* JJLogOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534723B60FB80097C4D9 /* JJLogOutput.swift */; }; 32 | 614D5A9C23BA09D3004E7AA2 /* JJConsoleOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534923B612FA0097C4D9 /* JJConsoleOutput.swift */; }; 33 | 614D5A9D23BA09D3004E7AA2 /* JJFileOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534B23B6133F0097C4D9 /* JJFileOutput.swift */; }; 34 | 614D5A9E23BA09D3004E7AA2 /* JJLogOutput+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534D23B6137F0097C4D9 /* JJLogOutput+Extension.swift */; }; 35 | 6150532323B606400097C4D9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150532223B606400097C4D9 /* AppDelegate.swift */; }; 36 | 6150532523B606410097C4D9 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150532423B606410097C4D9 /* SceneDelegate.swift */; }; 37 | 6150532723B606410097C4D9 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150532623B606410097C4D9 /* ViewController.swift */; }; 38 | 6150532A23B606410097C4D9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6150532823B606410097C4D9 /* Main.storyboard */; }; 39 | 6150532C23B606450097C4D9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6150532B23B606450097C4D9 /* Assets.xcassets */; }; 40 | 6150532F23B606450097C4D9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6150532D23B606450097C4D9 /* LaunchScreen.storyboard */; }; 41 | 6150533A23B606460097C4D9 /* JJSwiftLogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150533923B606460097C4D9 /* JJSwiftLogTests.swift */; }; 42 | 6150534623B609890097C4D9 /* JJSwiftLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534523B609890097C4D9 /* JJSwiftLog.swift */; }; 43 | 6150534823B60FB80097C4D9 /* JJLogOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534723B60FB80097C4D9 /* JJLogOutput.swift */; }; 44 | 6150534A23B612FA0097C4D9 /* JJConsoleOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534923B612FA0097C4D9 /* JJConsoleOutput.swift */; }; 45 | 6150534C23B6133F0097C4D9 /* JJFileOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534B23B6133F0097C4D9 /* JJFileOutput.swift */; }; 46 | 6150534E23B6137F0097C4D9 /* JJLogOutput+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6150534D23B6137F0097C4D9 /* JJLogOutput+Extension.swift */; }; 47 | 6174B98F23F83AFA00841805 /* JJLogFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6174B98E23F83AFA00841805 /* JJLogFormatter.swift */; }; 48 | 61E1BB542793F85200FE223B /* JJFormatterLogANSIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61E1BB532793F85100FE223B /* JJFormatterLogANSIColor.swift */; }; 49 | 61E1BB552793F85200FE223B /* JJFormatterLogANSIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61E1BB532793F85100FE223B /* JJFormatterLogANSIColor.swift */; }; 50 | /* End PBXBuildFile section */ 51 | 52 | /* Begin PBXContainerItemProxy section */ 53 | 614D5A8623BA09B0004E7AA2 /* PBXContainerItemProxy */ = { 54 | isa = PBXContainerItemProxy; 55 | containerPortal = 6150531723B606400097C4D9 /* Project object */; 56 | proxyType = 1; 57 | remoteGlobalIDString = 614D5A7B23BA09AF004E7AA2; 58 | remoteInfo = JJSwiftLogCarthage; 59 | }; 60 | 614D5A8823BA09B0004E7AA2 /* PBXContainerItemProxy */ = { 61 | isa = PBXContainerItemProxy; 62 | containerPortal = 6150531723B606400097C4D9 /* Project object */; 63 | proxyType = 1; 64 | remoteGlobalIDString = 6150531E23B606400097C4D9; 65 | remoteInfo = JJSwiftLog; 66 | }; 67 | 614D5A8F23BA09B0004E7AA2 /* PBXContainerItemProxy */ = { 68 | isa = PBXContainerItemProxy; 69 | containerPortal = 6150531723B606400097C4D9 /* Project object */; 70 | proxyType = 1; 71 | remoteGlobalIDString = 614D5A7B23BA09AF004E7AA2; 72 | remoteInfo = JJSwiftLogCarthage; 73 | }; 74 | 6150533623B606460097C4D9 /* PBXContainerItemProxy */ = { 75 | isa = PBXContainerItemProxy; 76 | containerPortal = 6150531723B606400097C4D9 /* Project object */; 77 | proxyType = 1; 78 | remoteGlobalIDString = 6150531E23B606400097C4D9; 79 | remoteInfo = JJSwiftLog; 80 | }; 81 | /* End PBXContainerItemProxy section */ 82 | 83 | /* Begin PBXCopyFilesBuildPhase section */ 84 | 614D5A9623BA09B0004E7AA2 /* Embed Frameworks */ = { 85 | isa = PBXCopyFilesBuildPhase; 86 | buildActionMask = 2147483647; 87 | dstPath = ""; 88 | dstSubfolderSpec = 10; 89 | files = ( 90 | 614D5A9223BA09B0004E7AA2 /* JJSwiftLogCarthage.framework in Embed Frameworks */, 91 | ); 92 | name = "Embed Frameworks"; 93 | runOnlyForDeploymentPostprocessing = 0; 94 | }; 95 | /* End PBXCopyFilesBuildPhase section */ 96 | 97 | /* Begin PBXFileReference section */ 98 | 0358C6CA66EF7E629F0A14EE /* Pods_JJSwiftLogCarthageTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JJSwiftLogCarthageTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 99 | 4819EBB49379FF121EED771A /* Pods-JJSwiftLogCarthageTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JJSwiftLogCarthageTests.debug.xcconfig"; path = "Target Support Files/Pods-JJSwiftLogCarthageTests/Pods-JJSwiftLogCarthageTests.debug.xcconfig"; sourceTree = ""; }; 100 | 4E8B4E73495DBCAC16BF63A9 /* Pods-JJSwiftLogTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JJSwiftLogTests.debug.xcconfig"; path = "Target Support Files/Pods-JJSwiftLogTests/Pods-JJSwiftLogTests.debug.xcconfig"; sourceTree = ""; }; 101 | 610FBB2D2781852B0021BB00 /* JJLogEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJLogEntity.swift; sourceTree = ""; }; 102 | 610FBB2F2781867A0021BB00 /* JJLogFormatterProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJLogFormatterProtocol.swift; sourceTree = ""; }; 103 | 610FBB3327888CA40021BB00 /* JJLogObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJLogObject.swift; sourceTree = ""; }; 104 | 613A363527B013BC0071C021 /* FormatterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormatterTests.swift; sourceTree = ""; }; 105 | 613A363727B769DA0071C021 /* JJSentryOutput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJSentryOutput.swift; sourceTree = ""; }; 106 | 613A363927C244AC0071C021 /* SentryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTests.swift; sourceTree = ""; }; 107 | 613BFC93278B220A00F4D77B /* JJLogFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJLogFilter.swift; sourceTree = ""; }; 108 | 614D5A7C23BA09AF004E7AA2 /* JJSwiftLogCarthage.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JJSwiftLogCarthage.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 109 | 614D5A7E23BA09AF004E7AA2 /* JJSwiftLogCarthage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JJSwiftLogCarthage.h; sourceTree = ""; }; 110 | 614D5A7F23BA09AF004E7AA2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 111 | 614D5A8423BA09AF004E7AA2 /* JJSwiftLogCarthageTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JJSwiftLogCarthageTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 112 | 614D5A8B23BA09B0004E7AA2 /* JJSwiftLogCarthageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJSwiftLogCarthageTests.swift; sourceTree = ""; }; 113 | 614D5A8D23BA09B0004E7AA2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 114 | 6150531F23B606400097C4D9 /* JJSwiftLog.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JJSwiftLog.app; sourceTree = BUILT_PRODUCTS_DIR; }; 115 | 6150532223B606400097C4D9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 116 | 6150532423B606410097C4D9 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 117 | 6150532623B606410097C4D9 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 118 | 6150532923B606410097C4D9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 119 | 6150532B23B606450097C4D9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 120 | 6150532E23B606450097C4D9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 121 | 6150533023B606450097C4D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 122 | 6150533523B606460097C4D9 /* JJSwiftLogTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JJSwiftLogTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 123 | 6150533923B606460097C4D9 /* JJSwiftLogTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJSwiftLogTests.swift; sourceTree = ""; }; 124 | 6150533B23B606460097C4D9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 125 | 6150534523B609890097C4D9 /* JJSwiftLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJSwiftLog.swift; sourceTree = ""; }; 126 | 6150534723B60FB80097C4D9 /* JJLogOutput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJLogOutput.swift; sourceTree = ""; }; 127 | 6150534923B612FA0097C4D9 /* JJConsoleOutput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJConsoleOutput.swift; sourceTree = ""; }; 128 | 6150534B23B6133F0097C4D9 /* JJFileOutput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJFileOutput.swift; sourceTree = ""; }; 129 | 6150534D23B6137F0097C4D9 /* JJLogOutput+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "JJLogOutput+Extension.swift"; sourceTree = ""; }; 130 | 6174B98E23F83AFA00841805 /* JJLogFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJLogFormatter.swift; sourceTree = ""; }; 131 | 61E1BB532793F85100FE223B /* JJFormatterLogANSIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JJFormatterLogANSIColor.swift; sourceTree = ""; }; 132 | 7D191C64310219DDC70DFB0B /* Pods-JJSwiftLog.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JJSwiftLog.release.xcconfig"; path = "Target Support Files/Pods-JJSwiftLog/Pods-JJSwiftLog.release.xcconfig"; sourceTree = ""; }; 133 | 96CADB581E94396F403436ED /* Pods-JJSwiftLogTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JJSwiftLogTests.release.xcconfig"; path = "Target Support Files/Pods-JJSwiftLogTests/Pods-JJSwiftLogTests.release.xcconfig"; sourceTree = ""; }; 134 | A76452E1943E25864935B817 /* Pods_JJSwiftLogTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JJSwiftLogTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 135 | B2E2D3B4EEAF588BB1D6AED7 /* Pods-JJSwiftLog.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JJSwiftLog.debug.xcconfig"; path = "Target Support Files/Pods-JJSwiftLog/Pods-JJSwiftLog.debug.xcconfig"; sourceTree = ""; }; 136 | C26FFCB646691C85F3670D4B /* Pods-JJSwiftLogCarthageTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JJSwiftLogCarthageTests.release.xcconfig"; path = "Target Support Files/Pods-JJSwiftLogCarthageTests/Pods-JJSwiftLogCarthageTests.release.xcconfig"; sourceTree = ""; }; 137 | EE62F46789707C0138E386AC /* Pods_JJSwiftLog.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JJSwiftLog.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 138 | /* End PBXFileReference section */ 139 | 140 | /* Begin PBXFrameworksBuildPhase section */ 141 | 614D5A7923BA09AF004E7AA2 /* Frameworks */ = { 142 | isa = PBXFrameworksBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | 614D5A8123BA09AF004E7AA2 /* Frameworks */ = { 149 | isa = PBXFrameworksBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | 614D5A8523BA09B0004E7AA2 /* JJSwiftLogCarthage.framework in Frameworks */, 153 | 3E0BA730BF456A5C8DE5E7E9 /* Pods_JJSwiftLogCarthageTests.framework in Frameworks */, 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | 6150531C23B606400097C4D9 /* Frameworks */ = { 158 | isa = PBXFrameworksBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | 614D5A9123BA09B0004E7AA2 /* JJSwiftLogCarthage.framework in Frameworks */, 162 | 25A01DFE5FC8C0BFCEFC9C01 /* Pods_JJSwiftLog.framework in Frameworks */, 163 | ); 164 | runOnlyForDeploymentPostprocessing = 0; 165 | }; 166 | 6150533223B606460097C4D9 /* Frameworks */ = { 167 | isa = PBXFrameworksBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | 53DEB30C57F2B327B5DE4663 /* Pods_JJSwiftLogTests.framework in Frameworks */, 171 | ); 172 | runOnlyForDeploymentPostprocessing = 0; 173 | }; 174 | /* End PBXFrameworksBuildPhase section */ 175 | 176 | /* Begin PBXGroup section */ 177 | 5E3DF81B9527F4E0015F2364 /* Pods */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | B2E2D3B4EEAF588BB1D6AED7 /* Pods-JJSwiftLog.debug.xcconfig */, 181 | 7D191C64310219DDC70DFB0B /* Pods-JJSwiftLog.release.xcconfig */, 182 | 4819EBB49379FF121EED771A /* Pods-JJSwiftLogCarthageTests.debug.xcconfig */, 183 | C26FFCB646691C85F3670D4B /* Pods-JJSwiftLogCarthageTests.release.xcconfig */, 184 | 4E8B4E73495DBCAC16BF63A9 /* Pods-JJSwiftLogTests.debug.xcconfig */, 185 | 96CADB581E94396F403436ED /* Pods-JJSwiftLogTests.release.xcconfig */, 186 | ); 187 | path = Pods; 188 | sourceTree = ""; 189 | }; 190 | 614D5A7D23BA09AF004E7AA2 /* JJSwiftLogCarthage */ = { 191 | isa = PBXGroup; 192 | children = ( 193 | 614D5A7E23BA09AF004E7AA2 /* JJSwiftLogCarthage.h */, 194 | 614D5A7F23BA09AF004E7AA2 /* Info.plist */, 195 | ); 196 | path = JJSwiftLogCarthage; 197 | sourceTree = ""; 198 | }; 199 | 614D5A8A23BA09B0004E7AA2 /* JJSwiftLogCarthageTests */ = { 200 | isa = PBXGroup; 201 | children = ( 202 | 614D5A8B23BA09B0004E7AA2 /* JJSwiftLogCarthageTests.swift */, 203 | 614D5A8D23BA09B0004E7AA2 /* Info.plist */, 204 | ); 205 | path = JJSwiftLogCarthageTests; 206 | sourceTree = ""; 207 | }; 208 | 6150531623B606400097C4D9 = { 209 | isa = PBXGroup; 210 | children = ( 211 | 6150532123B606400097C4D9 /* JJSwiftLog */, 212 | 6150533823B606460097C4D9 /* JJSwiftLogTests */, 213 | 614D5A7D23BA09AF004E7AA2 /* JJSwiftLogCarthage */, 214 | 614D5A8A23BA09B0004E7AA2 /* JJSwiftLogCarthageTests */, 215 | 6150532023B606400097C4D9 /* Products */, 216 | 5E3DF81B9527F4E0015F2364 /* Pods */, 217 | E3C2166B72817659D2EBB7AF /* Frameworks */, 218 | ); 219 | sourceTree = ""; 220 | }; 221 | 6150532023B606400097C4D9 /* Products */ = { 222 | isa = PBXGroup; 223 | children = ( 224 | 6150531F23B606400097C4D9 /* JJSwiftLog.app */, 225 | 6150533523B606460097C4D9 /* JJSwiftLogTests.xctest */, 226 | 614D5A7C23BA09AF004E7AA2 /* JJSwiftLogCarthage.framework */, 227 | 614D5A8423BA09AF004E7AA2 /* JJSwiftLogCarthageTests.xctest */, 228 | ); 229 | name = Products; 230 | sourceTree = ""; 231 | }; 232 | 6150532123B606400097C4D9 /* JJSwiftLog */ = { 233 | isa = PBXGroup; 234 | children = ( 235 | 6150534423B608B60097C4D9 /* Source */, 236 | 6150532223B606400097C4D9 /* AppDelegate.swift */, 237 | 6150532423B606410097C4D9 /* SceneDelegate.swift */, 238 | 6150532623B606410097C4D9 /* ViewController.swift */, 239 | 6150532823B606410097C4D9 /* Main.storyboard */, 240 | 6150532B23B606450097C4D9 /* Assets.xcassets */, 241 | 6150532D23B606450097C4D9 /* LaunchScreen.storyboard */, 242 | 6150533023B606450097C4D9 /* Info.plist */, 243 | ); 244 | path = JJSwiftLog; 245 | sourceTree = ""; 246 | }; 247 | 6150533823B606460097C4D9 /* JJSwiftLogTests */ = { 248 | isa = PBXGroup; 249 | children = ( 250 | 6150533923B606460097C4D9 /* JJSwiftLogTests.swift */, 251 | 6150533B23B606460097C4D9 /* Info.plist */, 252 | 613A363527B013BC0071C021 /* FormatterTests.swift */, 253 | 613A363927C244AC0071C021 /* SentryTests.swift */, 254 | ); 255 | path = JJSwiftLogTests; 256 | sourceTree = ""; 257 | }; 258 | 6150534423B608B60097C4D9 /* Source */ = { 259 | isa = PBXGroup; 260 | children = ( 261 | 61E1BB522793F7B500FE223B /* Formatter */, 262 | 6150534523B609890097C4D9 /* JJSwiftLog.swift */, 263 | 6150534723B60FB80097C4D9 /* JJLogOutput.swift */, 264 | 6150534923B612FA0097C4D9 /* JJConsoleOutput.swift */, 265 | 6150534B23B6133F0097C4D9 /* JJFileOutput.swift */, 266 | 6150534D23B6137F0097C4D9 /* JJLogOutput+Extension.swift */, 267 | 6174B98E23F83AFA00841805 /* JJLogFormatter.swift */, 268 | 610FBB2D2781852B0021BB00 /* JJLogEntity.swift */, 269 | 610FBB2F2781867A0021BB00 /* JJLogFormatterProtocol.swift */, 270 | 610FBB3327888CA40021BB00 /* JJLogObject.swift */, 271 | 613BFC93278B220A00F4D77B /* JJLogFilter.swift */, 272 | 613A363727B769DA0071C021 /* JJSentryOutput.swift */, 273 | ); 274 | path = Source; 275 | sourceTree = ""; 276 | }; 277 | 61E1BB522793F7B500FE223B /* Formatter */ = { 278 | isa = PBXGroup; 279 | children = ( 280 | 61E1BB532793F85100FE223B /* JJFormatterLogANSIColor.swift */, 281 | ); 282 | path = Formatter; 283 | sourceTree = ""; 284 | }; 285 | E3C2166B72817659D2EBB7AF /* Frameworks */ = { 286 | isa = PBXGroup; 287 | children = ( 288 | EE62F46789707C0138E386AC /* Pods_JJSwiftLog.framework */, 289 | 0358C6CA66EF7E629F0A14EE /* Pods_JJSwiftLogCarthageTests.framework */, 290 | A76452E1943E25864935B817 /* Pods_JJSwiftLogTests.framework */, 291 | ); 292 | name = Frameworks; 293 | sourceTree = ""; 294 | }; 295 | /* End PBXGroup section */ 296 | 297 | /* Begin PBXHeadersBuildPhase section */ 298 | 614D5A7723BA09AF004E7AA2 /* Headers */ = { 299 | isa = PBXHeadersBuildPhase; 300 | buildActionMask = 2147483647; 301 | files = ( 302 | 614D5A8E23BA09B0004E7AA2 /* JJSwiftLogCarthage.h in Headers */, 303 | ); 304 | runOnlyForDeploymentPostprocessing = 0; 305 | }; 306 | /* End PBXHeadersBuildPhase section */ 307 | 308 | /* Begin PBXNativeTarget section */ 309 | 614D5A7B23BA09AF004E7AA2 /* JJSwiftLogCarthage */ = { 310 | isa = PBXNativeTarget; 311 | buildConfigurationList = 614D5A9323BA09B0004E7AA2 /* Build configuration list for PBXNativeTarget "JJSwiftLogCarthage" */; 312 | buildPhases = ( 313 | 614D5A7723BA09AF004E7AA2 /* Headers */, 314 | 614D5A7823BA09AF004E7AA2 /* Sources */, 315 | 614D5A7923BA09AF004E7AA2 /* Frameworks */, 316 | 614D5A7A23BA09AF004E7AA2 /* Resources */, 317 | ); 318 | buildRules = ( 319 | ); 320 | dependencies = ( 321 | ); 322 | name = JJSwiftLogCarthage; 323 | productName = JJSwiftLogCarthage; 324 | productReference = 614D5A7C23BA09AF004E7AA2 /* JJSwiftLogCarthage.framework */; 325 | productType = "com.apple.product-type.framework"; 326 | }; 327 | 614D5A8323BA09AF004E7AA2 /* JJSwiftLogCarthageTests */ = { 328 | isa = PBXNativeTarget; 329 | buildConfigurationList = 614D5A9723BA09B0004E7AA2 /* Build configuration list for PBXNativeTarget "JJSwiftLogCarthageTests" */; 330 | buildPhases = ( 331 | 37322E4D12E400054A8BAED2 /* [CP] Check Pods Manifest.lock */, 332 | 614D5A8023BA09AF004E7AA2 /* Sources */, 333 | 614D5A8123BA09AF004E7AA2 /* Frameworks */, 334 | 614D5A8223BA09AF004E7AA2 /* Resources */, 335 | ); 336 | buildRules = ( 337 | ); 338 | dependencies = ( 339 | 614D5A8723BA09B0004E7AA2 /* PBXTargetDependency */, 340 | 614D5A8923BA09B0004E7AA2 /* PBXTargetDependency */, 341 | ); 342 | name = JJSwiftLogCarthageTests; 343 | productName = JJSwiftLogCarthageTests; 344 | productReference = 614D5A8423BA09AF004E7AA2 /* JJSwiftLogCarthageTests.xctest */; 345 | productType = "com.apple.product-type.bundle.unit-test"; 346 | }; 347 | 6150531E23B606400097C4D9 /* JJSwiftLog */ = { 348 | isa = PBXNativeTarget; 349 | buildConfigurationList = 6150533E23B606460097C4D9 /* Build configuration list for PBXNativeTarget "JJSwiftLog" */; 350 | buildPhases = ( 351 | 583FBA8A0B3D0C92CA31CD6F /* [CP] Check Pods Manifest.lock */, 352 | 6150531B23B606400097C4D9 /* Sources */, 353 | 6150531C23B606400097C4D9 /* Frameworks */, 354 | 6150531D23B606400097C4D9 /* Resources */, 355 | 614D5A9623BA09B0004E7AA2 /* Embed Frameworks */, 356 | 61646C09252C7021001EF481 /* ShellScript */, 357 | ); 358 | buildRules = ( 359 | ); 360 | dependencies = ( 361 | 614D5A9023BA09B0004E7AA2 /* PBXTargetDependency */, 362 | ); 363 | name = JJSwiftLog; 364 | productName = JJSwiftLog; 365 | productReference = 6150531F23B606400097C4D9 /* JJSwiftLog.app */; 366 | productType = "com.apple.product-type.application"; 367 | }; 368 | 6150533423B606460097C4D9 /* JJSwiftLogTests */ = { 369 | isa = PBXNativeTarget; 370 | buildConfigurationList = 6150534123B606460097C4D9 /* Build configuration list for PBXNativeTarget "JJSwiftLogTests" */; 371 | buildPhases = ( 372 | E8196DDDFCA77DD978CAB076 /* [CP] Check Pods Manifest.lock */, 373 | 6150533123B606460097C4D9 /* Sources */, 374 | 6150533223B606460097C4D9 /* Frameworks */, 375 | 6150533323B606460097C4D9 /* Resources */, 376 | ); 377 | buildRules = ( 378 | ); 379 | dependencies = ( 380 | 6150533723B606460097C4D9 /* PBXTargetDependency */, 381 | ); 382 | name = JJSwiftLogTests; 383 | productName = JJSwiftLogTests; 384 | productReference = 6150533523B606460097C4D9 /* JJSwiftLogTests.xctest */; 385 | productType = "com.apple.product-type.bundle.unit-test"; 386 | }; 387 | /* End PBXNativeTarget section */ 388 | 389 | /* Begin PBXProject section */ 390 | 6150531723B606400097C4D9 /* Project object */ = { 391 | isa = PBXProject; 392 | attributes = { 393 | LastSwiftUpdateCheck = 1120; 394 | LastUpgradeCheck = 1120; 395 | ORGANIZATIONNAME = JJSwiftLog; 396 | TargetAttributes = { 397 | 614D5A7B23BA09AF004E7AA2 = { 398 | CreatedOnToolsVersion = 11.2.1; 399 | }; 400 | 614D5A8323BA09AF004E7AA2 = { 401 | CreatedOnToolsVersion = 11.2.1; 402 | TestTargetID = 6150531E23B606400097C4D9; 403 | }; 404 | 6150531E23B606400097C4D9 = { 405 | CreatedOnToolsVersion = 11.2.1; 406 | }; 407 | 6150533423B606460097C4D9 = { 408 | CreatedOnToolsVersion = 11.2.1; 409 | TestTargetID = 6150531E23B606400097C4D9; 410 | }; 411 | }; 412 | }; 413 | buildConfigurationList = 6150531A23B606400097C4D9 /* Build configuration list for PBXProject "JJSwiftLog" */; 414 | compatibilityVersion = "Xcode 9.3"; 415 | developmentRegion = en; 416 | hasScannedForEncodings = 0; 417 | knownRegions = ( 418 | en, 419 | Base, 420 | ); 421 | mainGroup = 6150531623B606400097C4D9; 422 | productRefGroup = 6150532023B606400097C4D9 /* Products */; 423 | projectDirPath = ""; 424 | projectRoot = ""; 425 | targets = ( 426 | 6150531E23B606400097C4D9 /* JJSwiftLog */, 427 | 6150533423B606460097C4D9 /* JJSwiftLogTests */, 428 | 614D5A7B23BA09AF004E7AA2 /* JJSwiftLogCarthage */, 429 | 614D5A8323BA09AF004E7AA2 /* JJSwiftLogCarthageTests */, 430 | ); 431 | }; 432 | /* End PBXProject section */ 433 | 434 | /* Begin PBXResourcesBuildPhase section */ 435 | 614D5A7A23BA09AF004E7AA2 /* Resources */ = { 436 | isa = PBXResourcesBuildPhase; 437 | buildActionMask = 2147483647; 438 | files = ( 439 | ); 440 | runOnlyForDeploymentPostprocessing = 0; 441 | }; 442 | 614D5A8223BA09AF004E7AA2 /* Resources */ = { 443 | isa = PBXResourcesBuildPhase; 444 | buildActionMask = 2147483647; 445 | files = ( 446 | ); 447 | runOnlyForDeploymentPostprocessing = 0; 448 | }; 449 | 6150531D23B606400097C4D9 /* Resources */ = { 450 | isa = PBXResourcesBuildPhase; 451 | buildActionMask = 2147483647; 452 | files = ( 453 | 6150532F23B606450097C4D9 /* LaunchScreen.storyboard in Resources */, 454 | 6150532C23B606450097C4D9 /* Assets.xcassets in Resources */, 455 | 6150532A23B606410097C4D9 /* Main.storyboard in Resources */, 456 | ); 457 | runOnlyForDeploymentPostprocessing = 0; 458 | }; 459 | 6150533323B606460097C4D9 /* Resources */ = { 460 | isa = PBXResourcesBuildPhase; 461 | buildActionMask = 2147483647; 462 | files = ( 463 | ); 464 | runOnlyForDeploymentPostprocessing = 0; 465 | }; 466 | /* End PBXResourcesBuildPhase section */ 467 | 468 | /* Begin PBXShellScriptBuildPhase section */ 469 | 37322E4D12E400054A8BAED2 /* [CP] Check Pods Manifest.lock */ = { 470 | isa = PBXShellScriptBuildPhase; 471 | buildActionMask = 2147483647; 472 | files = ( 473 | ); 474 | inputFileListPaths = ( 475 | ); 476 | inputPaths = ( 477 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 478 | "${PODS_ROOT}/Manifest.lock", 479 | ); 480 | name = "[CP] Check Pods Manifest.lock"; 481 | outputFileListPaths = ( 482 | ); 483 | outputPaths = ( 484 | "$(DERIVED_FILE_DIR)/Pods-JJSwiftLogCarthageTests-checkManifestLockResult.txt", 485 | ); 486 | runOnlyForDeploymentPostprocessing = 0; 487 | shellPath = /bin/sh; 488 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 489 | showEnvVarsInLog = 0; 490 | }; 491 | 583FBA8A0B3D0C92CA31CD6F /* [CP] Check Pods Manifest.lock */ = { 492 | isa = PBXShellScriptBuildPhase; 493 | buildActionMask = 2147483647; 494 | files = ( 495 | ); 496 | inputFileListPaths = ( 497 | ); 498 | inputPaths = ( 499 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 500 | "${PODS_ROOT}/Manifest.lock", 501 | ); 502 | name = "[CP] Check Pods Manifest.lock"; 503 | outputFileListPaths = ( 504 | ); 505 | outputPaths = ( 506 | "$(DERIVED_FILE_DIR)/Pods-JJSwiftLog-checkManifestLockResult.txt", 507 | ); 508 | runOnlyForDeploymentPostprocessing = 0; 509 | shellPath = /bin/sh; 510 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 511 | showEnvVarsInLog = 0; 512 | }; 513 | 61646C09252C7021001EF481 /* ShellScript */ = { 514 | isa = PBXShellScriptBuildPhase; 515 | buildActionMask = 2147483647; 516 | files = ( 517 | ); 518 | inputFileListPaths = ( 519 | ); 520 | inputPaths = ( 521 | ); 522 | outputFileListPaths = ( 523 | ); 524 | outputPaths = ( 525 | ); 526 | runOnlyForDeploymentPostprocessing = 0; 527 | shellPath = /bin/sh; 528 | shellScript = "if which swiftlint >/dev/null; then\n swiftlint lint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n\n"; 529 | }; 530 | E8196DDDFCA77DD978CAB076 /* [CP] Check Pods Manifest.lock */ = { 531 | isa = PBXShellScriptBuildPhase; 532 | buildActionMask = 2147483647; 533 | files = ( 534 | ); 535 | inputFileListPaths = ( 536 | ); 537 | inputPaths = ( 538 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 539 | "${PODS_ROOT}/Manifest.lock", 540 | ); 541 | name = "[CP] Check Pods Manifest.lock"; 542 | outputFileListPaths = ( 543 | ); 544 | outputPaths = ( 545 | "$(DERIVED_FILE_DIR)/Pods-JJSwiftLogTests-checkManifestLockResult.txt", 546 | ); 547 | runOnlyForDeploymentPostprocessing = 0; 548 | shellPath = /bin/sh; 549 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 550 | showEnvVarsInLog = 0; 551 | }; 552 | /* End PBXShellScriptBuildPhase section */ 553 | 554 | /* Begin PBXSourcesBuildPhase section */ 555 | 614D5A7823BA09AF004E7AA2 /* Sources */ = { 556 | isa = PBXSourcesBuildPhase; 557 | buildActionMask = 2147483647; 558 | files = ( 559 | 610FBB312782AA4D0021BB00 /* JJLogEntity.swift in Sources */, 560 | 610FBB322782AA4D0021BB00 /* JJLogFormatterProtocol.swift in Sources */, 561 | 61E1BB552793F85200FE223B /* JJFormatterLogANSIColor.swift in Sources */, 562 | 612D73A224299C3800EDA133 /* JJLogFormatter.swift in Sources */, 563 | 610FBB3527888CA40021BB00 /* JJLogObject.swift in Sources */, 564 | 614D5A9A23BA09D3004E7AA2 /* JJSwiftLog.swift in Sources */, 565 | 614D5A9B23BA09D3004E7AA2 /* JJLogOutput.swift in Sources */, 566 | 613BFC95278B220A00F4D77B /* JJLogFilter.swift in Sources */, 567 | 614D5A9C23BA09D3004E7AA2 /* JJConsoleOutput.swift in Sources */, 568 | 614D5A9D23BA09D3004E7AA2 /* JJFileOutput.swift in Sources */, 569 | 614D5A9E23BA09D3004E7AA2 /* JJLogOutput+Extension.swift in Sources */, 570 | ); 571 | runOnlyForDeploymentPostprocessing = 0; 572 | }; 573 | 614D5A8023BA09AF004E7AA2 /* Sources */ = { 574 | isa = PBXSourcesBuildPhase; 575 | buildActionMask = 2147483647; 576 | files = ( 577 | 614D5A8C23BA09B0004E7AA2 /* JJSwiftLogCarthageTests.swift in Sources */, 578 | ); 579 | runOnlyForDeploymentPostprocessing = 0; 580 | }; 581 | 6150531B23B606400097C4D9 /* Sources */ = { 582 | isa = PBXSourcesBuildPhase; 583 | buildActionMask = 2147483647; 584 | files = ( 585 | 6150532723B606410097C4D9 /* ViewController.swift in Sources */, 586 | 6150534C23B6133F0097C4D9 /* JJFileOutput.swift in Sources */, 587 | 6150534823B60FB80097C4D9 /* JJLogOutput.swift in Sources */, 588 | 613A363827B769DA0071C021 /* JJSentryOutput.swift in Sources */, 589 | 610FBB2E2781852B0021BB00 /* JJLogEntity.swift in Sources */, 590 | 6150534A23B612FA0097C4D9 /* JJConsoleOutput.swift in Sources */, 591 | 6150532323B606400097C4D9 /* AppDelegate.swift in Sources */, 592 | 61E1BB542793F85200FE223B /* JJFormatterLogANSIColor.swift in Sources */, 593 | 613BFC94278B220A00F4D77B /* JJLogFilter.swift in Sources */, 594 | 6150534E23B6137F0097C4D9 /* JJLogOutput+Extension.swift in Sources */, 595 | 6174B98F23F83AFA00841805 /* JJLogFormatter.swift in Sources */, 596 | 610FBB302781867A0021BB00 /* JJLogFormatterProtocol.swift in Sources */, 597 | 610FBB3427888CA40021BB00 /* JJLogObject.swift in Sources */, 598 | 6150534623B609890097C4D9 /* JJSwiftLog.swift in Sources */, 599 | 6150532523B606410097C4D9 /* SceneDelegate.swift in Sources */, 600 | ); 601 | runOnlyForDeploymentPostprocessing = 0; 602 | }; 603 | 6150533123B606460097C4D9 /* Sources */ = { 604 | isa = PBXSourcesBuildPhase; 605 | buildActionMask = 2147483647; 606 | files = ( 607 | 613A363627B013BC0071C021 /* FormatterTests.swift in Sources */, 608 | 6150533A23B606460097C4D9 /* JJSwiftLogTests.swift in Sources */, 609 | 613A363A27C244AC0071C021 /* SentryTests.swift in Sources */, 610 | ); 611 | runOnlyForDeploymentPostprocessing = 0; 612 | }; 613 | /* End PBXSourcesBuildPhase section */ 614 | 615 | /* Begin PBXTargetDependency section */ 616 | 614D5A8723BA09B0004E7AA2 /* PBXTargetDependency */ = { 617 | isa = PBXTargetDependency; 618 | target = 614D5A7B23BA09AF004E7AA2 /* JJSwiftLogCarthage */; 619 | targetProxy = 614D5A8623BA09B0004E7AA2 /* PBXContainerItemProxy */; 620 | }; 621 | 614D5A8923BA09B0004E7AA2 /* PBXTargetDependency */ = { 622 | isa = PBXTargetDependency; 623 | target = 6150531E23B606400097C4D9 /* JJSwiftLog */; 624 | targetProxy = 614D5A8823BA09B0004E7AA2 /* PBXContainerItemProxy */; 625 | }; 626 | 614D5A9023BA09B0004E7AA2 /* PBXTargetDependency */ = { 627 | isa = PBXTargetDependency; 628 | target = 614D5A7B23BA09AF004E7AA2 /* JJSwiftLogCarthage */; 629 | targetProxy = 614D5A8F23BA09B0004E7AA2 /* PBXContainerItemProxy */; 630 | }; 631 | 6150533723B606460097C4D9 /* PBXTargetDependency */ = { 632 | isa = PBXTargetDependency; 633 | target = 6150531E23B606400097C4D9 /* JJSwiftLog */; 634 | targetProxy = 6150533623B606460097C4D9 /* PBXContainerItemProxy */; 635 | }; 636 | /* End PBXTargetDependency section */ 637 | 638 | /* Begin PBXVariantGroup section */ 639 | 6150532823B606410097C4D9 /* Main.storyboard */ = { 640 | isa = PBXVariantGroup; 641 | children = ( 642 | 6150532923B606410097C4D9 /* Base */, 643 | ); 644 | name = Main.storyboard; 645 | sourceTree = ""; 646 | }; 647 | 6150532D23B606450097C4D9 /* LaunchScreen.storyboard */ = { 648 | isa = PBXVariantGroup; 649 | children = ( 650 | 6150532E23B606450097C4D9 /* Base */, 651 | ); 652 | name = LaunchScreen.storyboard; 653 | sourceTree = ""; 654 | }; 655 | /* End PBXVariantGroup section */ 656 | 657 | /* Begin XCBuildConfiguration section */ 658 | 614D5A9423BA09B0004E7AA2 /* Debug */ = { 659 | isa = XCBuildConfiguration; 660 | buildSettings = { 661 | CODE_SIGN_STYLE = Automatic; 662 | CURRENT_PROJECT_VERSION = 1; 663 | DEFINES_MODULE = YES; 664 | DEVELOPMENT_TEAM = 6PA8SJWBRK; 665 | DYLIB_COMPATIBILITY_VERSION = 1; 666 | DYLIB_CURRENT_VERSION = 1; 667 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 668 | INFOPLIST_FILE = JJSwiftLogCarthage/Info.plist; 669 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 670 | LD_RUNPATH_SEARCH_PATHS = ( 671 | "$(inherited)", 672 | "@executable_path/Frameworks", 673 | "@loader_path/Frameworks", 674 | ); 675 | PRODUCT_BUNDLE_IDENTIFIER = xxx.JJSwiftLogCarthage; 676 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 677 | SKIP_INSTALL = YES; 678 | SWIFT_VERSION = 5.0; 679 | TARGETED_DEVICE_FAMILY = "1,2"; 680 | VERSIONING_SYSTEM = "apple-generic"; 681 | VERSION_INFO_PREFIX = ""; 682 | }; 683 | name = Debug; 684 | }; 685 | 614D5A9523BA09B0004E7AA2 /* Release */ = { 686 | isa = XCBuildConfiguration; 687 | buildSettings = { 688 | CODE_SIGN_STYLE = Automatic; 689 | CURRENT_PROJECT_VERSION = 1; 690 | DEFINES_MODULE = YES; 691 | DEVELOPMENT_TEAM = 6PA8SJWBRK; 692 | DYLIB_COMPATIBILITY_VERSION = 1; 693 | DYLIB_CURRENT_VERSION = 1; 694 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 695 | INFOPLIST_FILE = JJSwiftLogCarthage/Info.plist; 696 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 697 | LD_RUNPATH_SEARCH_PATHS = ( 698 | "$(inherited)", 699 | "@executable_path/Frameworks", 700 | "@loader_path/Frameworks", 701 | ); 702 | PRODUCT_BUNDLE_IDENTIFIER = xxx.JJSwiftLogCarthage; 703 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 704 | SKIP_INSTALL = YES; 705 | SWIFT_VERSION = 5.0; 706 | TARGETED_DEVICE_FAMILY = "1,2"; 707 | VERSIONING_SYSTEM = "apple-generic"; 708 | VERSION_INFO_PREFIX = ""; 709 | }; 710 | name = Release; 711 | }; 712 | 614D5A9823BA09B0004E7AA2 /* Debug */ = { 713 | isa = XCBuildConfiguration; 714 | baseConfigurationReference = 4819EBB49379FF121EED771A /* Pods-JJSwiftLogCarthageTests.debug.xcconfig */; 715 | buildSettings = { 716 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 717 | CODE_SIGN_STYLE = Automatic; 718 | DEVELOPMENT_TEAM = 6PA8SJWBRK; 719 | INFOPLIST_FILE = JJSwiftLogCarthageTests/Info.plist; 720 | LD_RUNPATH_SEARCH_PATHS = ( 721 | "$(inherited)", 722 | "@executable_path/Frameworks", 723 | "@loader_path/Frameworks", 724 | ); 725 | PRODUCT_BUNDLE_IDENTIFIER = xxx.JJSwiftLogCarthageTests; 726 | PRODUCT_NAME = "$(TARGET_NAME)"; 727 | SWIFT_VERSION = 5.0; 728 | TARGETED_DEVICE_FAMILY = "1,2"; 729 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JJSwiftLog.app/JJSwiftLog"; 730 | }; 731 | name = Debug; 732 | }; 733 | 614D5A9923BA09B0004E7AA2 /* Release */ = { 734 | isa = XCBuildConfiguration; 735 | baseConfigurationReference = C26FFCB646691C85F3670D4B /* Pods-JJSwiftLogCarthageTests.release.xcconfig */; 736 | buildSettings = { 737 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 738 | CODE_SIGN_STYLE = Automatic; 739 | DEVELOPMENT_TEAM = 6PA8SJWBRK; 740 | INFOPLIST_FILE = JJSwiftLogCarthageTests/Info.plist; 741 | LD_RUNPATH_SEARCH_PATHS = ( 742 | "$(inherited)", 743 | "@executable_path/Frameworks", 744 | "@loader_path/Frameworks", 745 | ); 746 | PRODUCT_BUNDLE_IDENTIFIER = xxx.JJSwiftLogCarthageTests; 747 | PRODUCT_NAME = "$(TARGET_NAME)"; 748 | SWIFT_VERSION = 5.0; 749 | TARGETED_DEVICE_FAMILY = "1,2"; 750 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JJSwiftLog.app/JJSwiftLog"; 751 | }; 752 | name = Release; 753 | }; 754 | 6150533C23B606460097C4D9 /* Debug */ = { 755 | isa = XCBuildConfiguration; 756 | buildSettings = { 757 | ALWAYS_SEARCH_USER_PATHS = NO; 758 | CLANG_ANALYZER_NONNULL = YES; 759 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 760 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 761 | CLANG_CXX_LIBRARY = "libc++"; 762 | CLANG_ENABLE_MODULES = YES; 763 | CLANG_ENABLE_OBJC_ARC = YES; 764 | CLANG_ENABLE_OBJC_WEAK = YES; 765 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 766 | CLANG_WARN_BOOL_CONVERSION = YES; 767 | CLANG_WARN_COMMA = YES; 768 | CLANG_WARN_CONSTANT_CONVERSION = YES; 769 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 770 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 771 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 772 | CLANG_WARN_EMPTY_BODY = YES; 773 | CLANG_WARN_ENUM_CONVERSION = YES; 774 | CLANG_WARN_INFINITE_RECURSION = YES; 775 | CLANG_WARN_INT_CONVERSION = YES; 776 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 777 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 778 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 779 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 780 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 781 | CLANG_WARN_STRICT_PROTOTYPES = YES; 782 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 783 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 784 | CLANG_WARN_UNREACHABLE_CODE = YES; 785 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 786 | COPY_PHASE_STRIP = NO; 787 | DEBUG_INFORMATION_FORMAT = dwarf; 788 | ENABLE_STRICT_OBJC_MSGSEND = YES; 789 | ENABLE_TESTABILITY = YES; 790 | GCC_C_LANGUAGE_STANDARD = gnu11; 791 | GCC_DYNAMIC_NO_PIC = NO; 792 | GCC_NO_COMMON_BLOCKS = YES; 793 | GCC_OPTIMIZATION_LEVEL = 0; 794 | GCC_PREPROCESSOR_DEFINITIONS = ( 795 | "DEBUG=1", 796 | "$(inherited)", 797 | ); 798 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 799 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 800 | GCC_WARN_UNDECLARED_SELECTOR = YES; 801 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 802 | GCC_WARN_UNUSED_FUNCTION = YES; 803 | GCC_WARN_UNUSED_VARIABLE = YES; 804 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 805 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 806 | MTL_FAST_MATH = YES; 807 | ONLY_ACTIVE_ARCH = YES; 808 | SDKROOT = iphoneos; 809 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 810 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 811 | }; 812 | name = Debug; 813 | }; 814 | 6150533D23B606460097C4D9 /* Release */ = { 815 | isa = XCBuildConfiguration; 816 | buildSettings = { 817 | ALWAYS_SEARCH_USER_PATHS = NO; 818 | CLANG_ANALYZER_NONNULL = YES; 819 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 820 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 821 | CLANG_CXX_LIBRARY = "libc++"; 822 | CLANG_ENABLE_MODULES = YES; 823 | CLANG_ENABLE_OBJC_ARC = YES; 824 | CLANG_ENABLE_OBJC_WEAK = YES; 825 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 826 | CLANG_WARN_BOOL_CONVERSION = YES; 827 | CLANG_WARN_COMMA = YES; 828 | CLANG_WARN_CONSTANT_CONVERSION = YES; 829 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 830 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 831 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 832 | CLANG_WARN_EMPTY_BODY = YES; 833 | CLANG_WARN_ENUM_CONVERSION = YES; 834 | CLANG_WARN_INFINITE_RECURSION = YES; 835 | CLANG_WARN_INT_CONVERSION = YES; 836 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 837 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 838 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 839 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 840 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 841 | CLANG_WARN_STRICT_PROTOTYPES = YES; 842 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 843 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 844 | CLANG_WARN_UNREACHABLE_CODE = YES; 845 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 846 | COPY_PHASE_STRIP = NO; 847 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 848 | ENABLE_NS_ASSERTIONS = NO; 849 | ENABLE_STRICT_OBJC_MSGSEND = YES; 850 | GCC_C_LANGUAGE_STANDARD = gnu11; 851 | GCC_NO_COMMON_BLOCKS = YES; 852 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 853 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 854 | GCC_WARN_UNDECLARED_SELECTOR = YES; 855 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 856 | GCC_WARN_UNUSED_FUNCTION = YES; 857 | GCC_WARN_UNUSED_VARIABLE = YES; 858 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 859 | MTL_ENABLE_DEBUG_INFO = NO; 860 | MTL_FAST_MATH = YES; 861 | SDKROOT = iphoneos; 862 | SWIFT_COMPILATION_MODE = wholemodule; 863 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 864 | VALIDATE_PRODUCT = YES; 865 | }; 866 | name = Release; 867 | }; 868 | 6150533F23B606460097C4D9 /* Debug */ = { 869 | isa = XCBuildConfiguration; 870 | baseConfigurationReference = B2E2D3B4EEAF588BB1D6AED7 /* Pods-JJSwiftLog.debug.xcconfig */; 871 | buildSettings = { 872 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 873 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 874 | CODE_SIGN_STYLE = Automatic; 875 | DEVELOPMENT_TEAM = 6PA8SJWBRK; 876 | INFOPLIST_FILE = JJSwiftLog/Info.plist; 877 | LD_RUNPATH_SEARCH_PATHS = ( 878 | "$(inherited)", 879 | "@executable_path/Frameworks", 880 | ); 881 | PRODUCT_BUNDLE_IDENTIFIER = xxx.JJSwiftLog; 882 | PRODUCT_NAME = "$(TARGET_NAME)"; 883 | SWIFT_OBJC_BRIDGING_HEADER = ""; 884 | SWIFT_VERSION = 5.0; 885 | TARGETED_DEVICE_FAMILY = "1,2"; 886 | }; 887 | name = Debug; 888 | }; 889 | 6150534023B606460097C4D9 /* Release */ = { 890 | isa = XCBuildConfiguration; 891 | baseConfigurationReference = 7D191C64310219DDC70DFB0B /* Pods-JJSwiftLog.release.xcconfig */; 892 | buildSettings = { 893 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 894 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 895 | CODE_SIGN_STYLE = Automatic; 896 | DEVELOPMENT_TEAM = 6PA8SJWBRK; 897 | INFOPLIST_FILE = JJSwiftLog/Info.plist; 898 | LD_RUNPATH_SEARCH_PATHS = ( 899 | "$(inherited)", 900 | "@executable_path/Frameworks", 901 | ); 902 | PRODUCT_BUNDLE_IDENTIFIER = xxx.JJSwiftLog; 903 | PRODUCT_NAME = "$(TARGET_NAME)"; 904 | SWIFT_OBJC_BRIDGING_HEADER = ""; 905 | SWIFT_VERSION = 5.0; 906 | TARGETED_DEVICE_FAMILY = "1,2"; 907 | }; 908 | name = Release; 909 | }; 910 | 6150534223B606460097C4D9 /* Debug */ = { 911 | isa = XCBuildConfiguration; 912 | baseConfigurationReference = 4E8B4E73495DBCAC16BF63A9 /* Pods-JJSwiftLogTests.debug.xcconfig */; 913 | buildSettings = { 914 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 915 | BUNDLE_LOADER = "$(TEST_HOST)"; 916 | CODE_SIGN_STYLE = Automatic; 917 | DEVELOPMENT_TEAM = 6PA8SJWBRK; 918 | INFOPLIST_FILE = JJSwiftLogTests/Info.plist; 919 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 920 | LD_RUNPATH_SEARCH_PATHS = ( 921 | "$(inherited)", 922 | "@executable_path/Frameworks", 923 | "@loader_path/Frameworks", 924 | ); 925 | PRODUCT_BUNDLE_IDENTIFIER = xxx.JJSwiftLogTests; 926 | PRODUCT_NAME = "$(TARGET_NAME)"; 927 | SWIFT_VERSION = 5.0; 928 | TARGETED_DEVICE_FAMILY = "1,2"; 929 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JJSwiftLog.app/JJSwiftLog"; 930 | }; 931 | name = Debug; 932 | }; 933 | 6150534323B606460097C4D9 /* Release */ = { 934 | isa = XCBuildConfiguration; 935 | baseConfigurationReference = 96CADB581E94396F403436ED /* Pods-JJSwiftLogTests.release.xcconfig */; 936 | buildSettings = { 937 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 938 | BUNDLE_LOADER = "$(TEST_HOST)"; 939 | CODE_SIGN_STYLE = Automatic; 940 | DEVELOPMENT_TEAM = 6PA8SJWBRK; 941 | INFOPLIST_FILE = JJSwiftLogTests/Info.plist; 942 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 943 | LD_RUNPATH_SEARCH_PATHS = ( 944 | "$(inherited)", 945 | "@executable_path/Frameworks", 946 | "@loader_path/Frameworks", 947 | ); 948 | PRODUCT_BUNDLE_IDENTIFIER = xxx.JJSwiftLogTests; 949 | PRODUCT_NAME = "$(TARGET_NAME)"; 950 | SWIFT_VERSION = 5.0; 951 | TARGETED_DEVICE_FAMILY = "1,2"; 952 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JJSwiftLog.app/JJSwiftLog"; 953 | }; 954 | name = Release; 955 | }; 956 | /* End XCBuildConfiguration section */ 957 | 958 | /* Begin XCConfigurationList section */ 959 | 614D5A9323BA09B0004E7AA2 /* Build configuration list for PBXNativeTarget "JJSwiftLogCarthage" */ = { 960 | isa = XCConfigurationList; 961 | buildConfigurations = ( 962 | 614D5A9423BA09B0004E7AA2 /* Debug */, 963 | 614D5A9523BA09B0004E7AA2 /* Release */, 964 | ); 965 | defaultConfigurationIsVisible = 0; 966 | defaultConfigurationName = Release; 967 | }; 968 | 614D5A9723BA09B0004E7AA2 /* Build configuration list for PBXNativeTarget "JJSwiftLogCarthageTests" */ = { 969 | isa = XCConfigurationList; 970 | buildConfigurations = ( 971 | 614D5A9823BA09B0004E7AA2 /* Debug */, 972 | 614D5A9923BA09B0004E7AA2 /* Release */, 973 | ); 974 | defaultConfigurationIsVisible = 0; 975 | defaultConfigurationName = Release; 976 | }; 977 | 6150531A23B606400097C4D9 /* Build configuration list for PBXProject "JJSwiftLog" */ = { 978 | isa = XCConfigurationList; 979 | buildConfigurations = ( 980 | 6150533C23B606460097C4D9 /* Debug */, 981 | 6150533D23B606460097C4D9 /* Release */, 982 | ); 983 | defaultConfigurationIsVisible = 0; 984 | defaultConfigurationName = Release; 985 | }; 986 | 6150533E23B606460097C4D9 /* Build configuration list for PBXNativeTarget "JJSwiftLog" */ = { 987 | isa = XCConfigurationList; 988 | buildConfigurations = ( 989 | 6150533F23B606460097C4D9 /* Debug */, 990 | 6150534023B606460097C4D9 /* Release */, 991 | ); 992 | defaultConfigurationIsVisible = 0; 993 | defaultConfigurationName = Release; 994 | }; 995 | 6150534123B606460097C4D9 /* Build configuration list for PBXNativeTarget "JJSwiftLogTests" */ = { 996 | isa = XCConfigurationList; 997 | buildConfigurations = ( 998 | 6150534223B606460097C4D9 /* Debug */, 999 | 6150534323B606460097C4D9 /* Release */, 1000 | ); 1001 | defaultConfigurationIsVisible = 0; 1002 | defaultConfigurationName = Release; 1003 | }; 1004 | /* End XCConfigurationList section */ 1005 | }; 1006 | rootObject = 6150531723B606400097C4D9 /* Project object */; 1007 | } 1008 | -------------------------------------------------------------------------------- /JJSwiftLog.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JJSwiftLog.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JJSwiftLog.xcodeproj/project.xcworkspace/xcuserdata/jezz.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/bf2803f81a16f86f84c7993f97f87d737856837f/JJSwiftLog.xcodeproj/project.xcworkspace/xcuserdata/jezz.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JJSwiftLog.xcodeproj/xcshareddata/xcschemes/JJSwiftLogCarthage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /JJSwiftLog.xcodeproj/xcuserdata/jezz.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JJSwiftLog.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | JJSwiftLog.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 4 16 | 17 | JJSwiftLogCarthage.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 0 21 | 22 | 23 | SuppressBuildableAutocreation 24 | 25 | 614D5A7B23BA09AF004E7AA2 26 | 27 | primary 28 | 29 | 30 | 614D5A8323BA09AF004E7AA2 31 | 32 | primary 33 | 34 | 35 | 6150531E23B606400097C4D9 36 | 37 | primary 38 | 39 | 40 | 6150533423B606460097C4D9 41 | 42 | primary 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /JJSwiftLog.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /JJSwiftLog.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /JJSwiftLog/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // JJSwiftLog 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJ. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 15 | return true 16 | } 17 | 18 | // MARK: UISceneSession Lifecycle 19 | 20 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 21 | // Called when a new scene session is being created. 22 | // Use this method to select a configuration to create the new scene with. 23 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 24 | } 25 | 26 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 27 | // Called when the user discards a scene session. 28 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 29 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /JJSwiftLog/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /JJSwiftLog/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /JJSwiftLog/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /JJSwiftLog/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /JJSwiftLog/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | NSAppTransportSecurity 64 | 65 | NSAllowsArbitraryLoads 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /JJSwiftLog/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // JJSwiftLog 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJ. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 16 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 17 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 18 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 19 | guard let _ = (scene as? UIWindowScene) else { return } 20 | } 21 | 22 | func sceneDidDisconnect(_ scene: UIScene) { 23 | // Called as the scene is being released by the system. 24 | // This occurs shortly after the scene enters the background, or when its session is discarded. 25 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 26 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 27 | } 28 | 29 | func sceneDidBecomeActive(_ scene: UIScene) { 30 | // Called when the scene has moved from an inactive state to an active state. 31 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 32 | } 33 | 34 | func sceneWillResignActive(_ scene: UIScene) { 35 | // Called when the scene will move from an active state to an inactive state. 36 | // This may occur due to temporary interruptions (ex. an incoming phone call). 37 | } 38 | 39 | func sceneWillEnterForeground(_ scene: UIScene) { 40 | // Called as the scene transitions from the background to the foreground. 41 | // Use this method to undo the changes made on entering the background. 42 | } 43 | 44 | func sceneDidEnterBackground(_ scene: UIScene) { 45 | // Called as the scene transitions from the foreground to the background. 46 | // Use this method to save data, release shared resources, and store enough scene-specific state information 47 | // to restore the scene back to its current state. 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/Formatter/JJFormatterLogANSIColor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJFormatterLogANSIColor.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2022/1/16. 6 | // Copyright © 2022 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// ANSIColor 12 | open class JJFormatterLogANSIColor: JJLogFormatterProtocol { 13 | 14 | /// ANSI code 15 | public static let colorStart = "\u{001b}[" 16 | 17 | /// ANSI code 18 | public static let colorEnd = "\(colorStart)m" 19 | 20 | /// Level color dictionary 21 | internal var levelColor: [JJSwiftLog.Level: String] = [:] 22 | 23 | /// ANSI colours 24 | public enum ANSIColor { 25 | case green 26 | case yellow 27 | case blue 28 | case magenta 29 | case cyan 30 | case black 31 | case red 32 | 33 | public var foregroundColor: String { 34 | switch self { 35 | case .green: 36 | return "32" 37 | case .yellow: 38 | return "33" 39 | case .blue: 40 | return "34" 41 | case .magenta: 42 | return "35" 43 | case .cyan: 44 | return "36" 45 | case .black: 46 | return "30" 47 | case .red: 48 | return "31" 49 | } 50 | } 51 | 52 | public var backgroundColor: String { 53 | switch self { 54 | case .green: 55 | return "32" 56 | case .yellow: 57 | return "33" 58 | case .blue: 59 | return "34" 60 | case .magenta: 61 | return "35" 62 | case .cyan: 63 | return "36" 64 | case .black: 65 | return "40" 66 | case .red: 67 | return "41" 68 | } 69 | } 70 | } 71 | 72 | public init() { 73 | setupFormatting() 74 | } 75 | 76 | open func setupFormatting() { 77 | colour(level: .verbose, foregroundColor: .cyan) 78 | colour(level: .debug, foregroundColor: .green) 79 | colour(level: .info, foregroundColor: .blue) 80 | colour(level: .warning, foregroundColor: .yellow) 81 | colour(level: .error, foregroundColor: .red) 82 | } 83 | 84 | open func colour(level: JJSwiftLog.Level, foregroundColor: ANSIColor = .blue, backgroundColor: ANSIColor = .black) { 85 | let codes: [String] = [foregroundColor.foregroundColor, backgroundColor.backgroundColor] 86 | 87 | levelColor[level] = JJFormatterLogANSIColor.colorStart + codes.joined(separator: ";") + "m" 88 | } 89 | 90 | public func format(log: JJLogEntity, message: String) -> String { 91 | let start = levelColor[log.level] ?? "" 92 | return "\(start)\(message)\(JJFormatterLogANSIColor.colorEnd)" 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJConsoleOutput.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJConsoleOutput.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS) 12 | import Darwin 13 | #elseif os(Windows) 14 | import CRT 15 | #elseif canImport(Glibc) 16 | import Glibc 17 | #else 18 | #error("Unsupported runtime") 19 | #endif 20 | 21 | /// Console log 22 | /// 23 | /// Implement UNIX's `stdout` 24 | open class JJConsoleOutput: JJLogObject { 25 | 26 | /// File pointer 27 | private var _stdoutFilePointer: UnsafeMutablePointer? 28 | private var _stderrFilePointer: UnsafeMutablePointer? 29 | 30 | /// Use NSLog show console message 31 | /// 32 | /// Default value is false 33 | public var isUseNSLog: Bool = false 34 | 35 | public init(identifier: String = "") { 36 | super.init(identifier: identifier, delegate: nil) 37 | self.queue = DispatchQueue(label: "JJConsoleOutput") 38 | #if os(macOS) || os(tvOS) || os(iOS) || os(watchOS) 39 | _stdoutFilePointer = Darwin.stdout 40 | _stderrFilePointer = Darwin.stderr 41 | #elseif os(Windows) 42 | _stdoutFilePointer = CRT.stdout 43 | _stderrFilePointer = CRT.stderr 44 | #elseif canImport(Glibc) 45 | _stdoutFilePointer = Glibc.stdout 46 | _stderrFilePointer = Glibc.stderr 47 | #else 48 | #error("Unsupported runtime") 49 | #endif 50 | } 51 | 52 | open override func output(log: JJLogEntity, message: String) { 53 | if isUseNSLog { 54 | NSLog("%@", message) 55 | } else { 56 | self.writeMessageToConsole(message, isError: log.level == .error ? true : false) 57 | } 58 | } 59 | 60 | /// Write message to the std I/O 61 | /// - Parameters: 62 | /// - message: string log 63 | /// - isError: is error level 64 | private func writeMessageToConsole(_ message: String, isError: Bool) { 65 | if isError && self._stderrFilePointer != nil { 66 | self.writeStringToFile(message, filePointer: self._stderrFilePointer!) 67 | return 68 | } 69 | if self._stdoutFilePointer != nil { 70 | self.writeStringToFile(message, filePointer: self._stdoutFilePointer!) 71 | } 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJFileOutput.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJFileOutput.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Save the log to file 12 | /// 13 | /// Implement by the FILE Pointer 14 | open class JJFileOutput: JJLogObject { 15 | 16 | public static let maxFileSize: UInt64 = 1_048_576 17 | 18 | public static let maxTimeInterval: TimeInterval = 600 19 | 20 | /// The base file name of the log file 21 | private var baseFileName: String = "jjlogger" 22 | 23 | /// The extension of the log file name 24 | private var fileExtension: String = "log" 25 | 26 | /// Size of the current log file 27 | internal var currentLogFileSize: UInt64 = 0 28 | 29 | /// Start time of the current log file 30 | internal var currentLogStartTimeInterval: TimeInterval = 0 31 | 32 | // MARK: - Properties 33 | public var targetMaxFileSize: UInt64 = maxFileSize { 34 | didSet { 35 | if targetMaxFileSize < 1 { 36 | targetMaxFileSize = .max 37 | } 38 | } 39 | } 40 | 41 | public var targetMaxTimeInterval: TimeInterval = maxTimeInterval { 42 | didSet { 43 | if targetMaxTimeInterval < 1 { 44 | targetMaxTimeInterval = 0 45 | } 46 | } 47 | } 48 | 49 | public var targetMaxLogFiles: UInt8 = 10 { 50 | didSet { 51 | clearLogFiles() 52 | } 53 | } 54 | 55 | /// Option: the URL of the folder to store archived log files (defaults to the same folder as the initial log file) 56 | public var archiveFolderURL: URL? { 57 | didSet { 58 | guard let archiveFolderURL = archiveFolderURL else { return } 59 | try? FileManager.default.createDirectory(at: archiveFolderURL, withIntermediateDirectories: true) 60 | } 61 | } 62 | 63 | lazy var archiveDateFormatter: DateFormatter = { 64 | let formatter = DateFormatter() 65 | formatter.locale = NSLocale.current 66 | formatter.dateFormat = "_yyyy-MM-dd_HH-mm-ss" 67 | return formatter 68 | }() 69 | 70 | static var defaultLogFolderURL: URL { 71 | var defaultLogFolderURL: URL 72 | #if os(tvOS) || os(iOS) || os(watchOS) 73 | defaultLogFolderURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first! 74 | defaultLogFolderURL = defaultLogFolderURL.appendingPathComponent("jjlogger") 75 | try? FileManager.default.createDirectory(at: defaultLogFolderURL, withIntermediateDirectories: true) 76 | #elseif os(macOS) 77 | defaultLogFolderURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("jjlogger") 78 | try? FileManager.default.createDirectory(at: defaultLogFolderURL, withIntermediateDirectories: true, attributes: nil) 79 | 80 | #elseif os(Linux) 81 | defaultLogFolderURL = URL(fileURLWithPath: "/var/cache/") 82 | #endif 83 | return defaultLogFolderURL 84 | } 85 | 86 | /// File pointer 87 | private var _filePointer: UnsafeMutablePointer? 88 | 89 | /// File path, default path is cachesDirectory 90 | /// 91 | /// If device space warning, the cache file will remove by the system 92 | private(set) var logFilePath: String? 93 | 94 | /// if filePath nil,the log will save to `cachesDirectory` 95 | /// 96 | /// - Parameter filePath: File path 97 | /// - Parameter delegate: Current object callback 98 | /// - Parameter identifier: Output object identifier 99 | public init?(filePath: String? = nil, delegate: JJLogOutputDelegate? = nil, identifier: String = "") { 100 | super.init(identifier: identifier, delegate: delegate) 101 | 102 | if let filePath = filePath { 103 | logFilePath = filePath 104 | } else { 105 | logFilePath = self.logFileURL.relativePath 106 | } 107 | 108 | self.createNewFilePointer(filePath: logFilePath!) 109 | 110 | if _filePointer == nil { 111 | self.makeCallbackLog(message: "Create file pointer failed") 112 | return nil 113 | } 114 | #if os(iOS) || os(watchOS) || os(tvOS) 115 | if #available(iOS 10.0, *) { 116 | do { 117 | var attributes = try FileManager.default.attributesOfItem(atPath: logFilePath ?? "") 118 | attributes[FileAttributeKey.protectionKey] = FileProtectionType.none 119 | try FileManager.default.setAttributes(attributes, ofItemAtPath: logFilePath ?? "") 120 | currentLogFileSize = attributes[.size] as? UInt64 ?? 0 121 | currentLogStartTimeInterval = (attributes[.creationDate] as? Date ?? Date()).timeIntervalSince1970 122 | } catch let error { 123 | self.makeCallbackLog(message: error.localizedDescription) 124 | } 125 | } 126 | #endif 127 | self.queue = DispatchQueue(label: "JJFileOutput") 128 | self.makeCallbackLog(message: ">>> JJSwiftLog Writing path: " + logFilePath!) 129 | } 130 | 131 | open override func output(log: JJLogEntity, message: String) { 132 | self.write(string: message) 133 | } 134 | 135 | /// Write log to file 136 | /// - Parameter string: Log text 137 | private func write(string: String) { 138 | 139 | currentLogFileSize += UInt64(string.count) 140 | 141 | // Check file exist, if not exist will recreate 142 | if access(logFilePath, F_OK) == -1 { 143 | freopen(logFilePath, "w+", _filePointer) 144 | } 145 | 146 | // Write string to file 147 | if _filePointer != nil { 148 | self.writeStringToFile(string, filePointer: _filePointer!) 149 | } 150 | 151 | // Check need to create new file 152 | if needNewFile() { 153 | createNewFile() 154 | } 155 | } 156 | } 157 | 158 | extension JJFileOutput { 159 | 160 | /// Log file url 161 | var logFileURL: URL { 162 | var archiveFolderURL: URL = (self.archiveFolderURL ?? JJFileOutput.defaultLogFolderURL) 163 | archiveFolderURL = archiveFolderURL.appendingPathComponent("\(baseFileName)\(archiveDateFormatter.string(from: Date()))") 164 | archiveFolderURL = archiveFolderURL.appendingPathExtension(fileExtension) 165 | return archiveFolderURL 166 | } 167 | 168 | /// Create new file pointer 169 | /// - Parameter filePath: filePath 170 | public func createNewFilePointer(filePath: String) { 171 | if _filePointer != nil { 172 | fclose(_filePointer) 173 | _filePointer = nil 174 | } 175 | _filePointer = fopen(filePath, "aw+") 176 | } 177 | 178 | /// Create new file 179 | public func createNewFile() { 180 | 181 | let archiveFolderURL = self.logFileURL 182 | 183 | self.createNewFilePointer(filePath: archiveFolderURL.relativePath) 184 | 185 | currentLogStartTimeInterval = Date().timeIntervalSince1970 186 | currentLogFileSize = 0 187 | 188 | clearLogFiles() 189 | } 190 | 191 | /// Clear the greater the targetMaxLogFiles size 192 | func clearLogFiles() { 193 | var archivedFileURLs: [URL] = self.archivedURLs() 194 | guard archivedFileURLs.count > Int(targetMaxLogFiles) else { return } 195 | 196 | archivedFileURLs.removeFirst(Int(targetMaxLogFiles)) 197 | 198 | let fileManager: FileManager = FileManager.default 199 | for archivedFileURL in archivedFileURLs { 200 | do { 201 | try fileManager.removeItem(at: archivedFileURL) 202 | } catch let error as NSError { 203 | self.makeCallbackLog(message: error.localizedDescription) 204 | } 205 | } 206 | } 207 | 208 | /// Archived the log files URL 209 | /// - Returns: [URL] 210 | func archivedURLs() -> [URL] { 211 | let archiveFolderURL: URL = (self.archiveFolderURL ?? type(of: self).defaultLogFolderURL) 212 | guard let fileURLs = try? FileManager.default.contentsOfDirectory(at: archiveFolderURL, includingPropertiesForKeys: nil, options: [.skipsHiddenFiles]) else { return [] } 213 | 214 | var archivedDetails: [(url: URL, timestamp: TimeInterval)] = [] 215 | for fileURL in fileURLs { 216 | let attributes = try? FileManager.default.attributesOfItem(atPath: fileURL.path) 217 | let date = attributes?[.creationDate] as? Date ?? Date() 218 | archivedDetails.append((fileURL, date.timeIntervalSince1970)) 219 | } 220 | 221 | archivedDetails.sort(by: { (lhs, rhs) -> Bool in lhs.timestamp > rhs.timestamp }) 222 | var archivedFileURLs: [URL] = [] 223 | for archivedDetail in archivedDetails { 224 | archivedFileURLs.append(archivedDetail.url) 225 | } 226 | 227 | return archivedFileURLs 228 | } 229 | 230 | /// Check the need to new file status 231 | /// - Returns: Ture or False 232 | public func needNewFile() -> Bool { 233 | 234 | guard currentLogFileSize < targetMaxFileSize else { return true } 235 | 236 | guard targetMaxTimeInterval > 0 else { return false } 237 | 238 | guard Date().timeIntervalSince1970 - currentLogStartTimeInterval < targetMaxTimeInterval else { return true } 239 | return false 240 | } 241 | } 242 | 243 | extension JJFileOutput { 244 | 245 | func makeCallbackLog(message: String) { 246 | let log = JJLogEntity(level: .info, date: Date(), message: message, functionName: "", fileName: "", lineNumber: 0) 247 | self.delegate?.internalLog(source: self, log: log) 248 | } 249 | 250 | /// Delete log file 251 | /// - Returns: true delete success, false delete failed 252 | public func deleteLogFile() -> Bool { 253 | guard let filePath = self.logFilePath else { 254 | return false 255 | } 256 | guard FileManager.default.fileExists(atPath: filePath) else { 257 | return false 258 | } 259 | do { 260 | try FileManager.default.removeItem(atPath: filePath) 261 | return true 262 | } catch let error { 263 | self.makeCallbackLog(message: error.localizedDescription) 264 | return false 265 | } 266 | } 267 | 268 | /// Archive log file to customer path 269 | /// - Parameter logFilePath: Customer path 270 | public func archiveLogFilePath(_ logFilePath: String) { 271 | guard let filePath = self.logFilePath else { 272 | return 273 | } 274 | guard FileManager.default.fileExists(atPath: filePath) else { 275 | return 276 | } 277 | do { 278 | if FileManager.default.fileExists(atPath: logFilePath) { 279 | try FileManager.default.removeItem(at: URL(fileURLWithPath: logFilePath)) 280 | } 281 | try FileManager.default.copyItem(atPath: filePath, toPath: logFilePath) 282 | } catch let error { 283 | self.makeCallbackLog(message: error.localizedDescription) 284 | } 285 | } 286 | } 287 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJLogEntity.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJLogMeta.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2022/1/2. 6 | // Copyright © 2022 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Log object 12 | public struct JJLogEntity { 13 | 14 | /// Log level 15 | public var level: JJSwiftLog.Level 16 | 17 | /// Date 18 | public var date: Date 19 | 20 | /// Message 21 | public var message: String 22 | 23 | /// Function name 24 | public var functionName: String 25 | 26 | /// File name 27 | public var fileName: String 28 | 29 | /// Line number 30 | public var lineNumber: Int 31 | 32 | /// Extra info 33 | public var extraInfo: [String: Any] 34 | 35 | /// Init 36 | /// - Parameters: 37 | /// - level: Log level 38 | /// - date: Send time 39 | /// - message: Message 40 | /// - functionName: Function 41 | /// - fileName: File 42 | /// - lineNumber: Line 43 | /// - extraInfo: Extra info 44 | public init(level: JJSwiftLog.Level, date: Date, message: String, functionName: String, fileName: String, lineNumber: Int, extraInfo: [String: Any] = [:]) { 45 | self.level = level 46 | self.date = date 47 | self.message = message 48 | self.functionName = functionName 49 | self.fileName = fileName 50 | self.lineNumber = lineNumber 51 | self.extraInfo = extraInfo 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJLogFilter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJLogFilter.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2022/1/9. 6 | // Copyright © 2022 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Filter the log message 12 | public protocol JJLogFilter { 13 | 14 | /// Filter the log object and format message 15 | /// - Returns: If return true, will ignore the log, if return false, will handle log 16 | func ignore(log: JJLogEntity, message: String) -> Bool 17 | } 18 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJLogFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJLogFormatter.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2020/2/15. 6 | // Copyright © 2020 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Formatter option 12 | public enum FormatterOption: String { 13 | // Text message 14 | case message = "M" 15 | // Log level 16 | case level = "L" 17 | // Log number 18 | case line = "l" 19 | // Log file name(without extension) 20 | case file = "F" 21 | // Log function 22 | case function = "f" 23 | // Date, format: yyyy-MM-dd HH:mm:ss.SSSZ 24 | case date = "D" 25 | // Only Date, format: yyyy-MM-dd 26 | case onlyDate = "d" 27 | // Only Time, format: HH:mm:ss 28 | case time = "t" 29 | // Thread name 30 | case thread = "T" 31 | // Origin text 32 | case origin = "origin" 33 | // Ignore text 34 | case ignore = "I" 35 | // Log file name with extension 36 | case fileExtension = "N" 37 | } 38 | 39 | /// Format log segment 40 | public enum LogSegment { 41 | /// Log token 42 | case token(FormatterOption, String) 43 | 44 | } 45 | 46 | /// JJLogFormatter 47 | public final class JJLogFormatter { 48 | 49 | /// Singleton JJLogFormatter 50 | public static let shared: JJLogFormatter = { 51 | let format = JJLogFormatter() 52 | return format 53 | }() 54 | 55 | private init() { 56 | 57 | } 58 | 59 | /// Generata segments array 60 | lazy public var segments = { 61 | return [LogSegment]() 62 | }() 63 | 64 | /// Format log will generate segments 65 | /// - Parameter formatter: formatter string 66 | func formatLog(_ formatter: String) { 67 | 68 | if formatter.isEmpty { 69 | return 70 | } 71 | 72 | self.segments.removeAll() 73 | 74 | let phrases = ("%I" + formatter).components(separatedBy: "%") 75 | 76 | for phrase in phrases where !phrase.isEmpty { 77 | let (_, offset) = self.parsePadding(phrase) 78 | 79 | let formatCharIndex = phrase.index(phrase.startIndex, offsetBy: offset) 80 | let formatChar = phrase[formatCharIndex] 81 | 82 | let rangeAfterFormatChar = phrase.index(formatCharIndex, offsetBy: 1).. (Int, Int) { 103 | let sign: Int = 1 104 | 105 | let numString = text.prefix { $0 >= "0" && $0 <= "9" } 106 | if let num = Int(String(numString)) { 107 | return (sign * num, (sign == -1 ? 1 : 0) + numString.count) 108 | } else { 109 | return (0, 0) 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJLogFormatterProtocol.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJLogFormat.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2022/1/2. 6 | // Copyright © 2022 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Log format protocol 12 | public protocol JJLogFormatterProtocol { 13 | 14 | /// Format object to String 15 | /// - Parameters: 16 | /// - log: Origin log object 17 | /// - message: Previous formatter result 18 | /// - Returns: Format string result 19 | func format(log: JJLogEntity, message: String) -> String 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJLogObject.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJLogObject.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2022/1/7. 6 | // Copyright © 2022 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Log base class object 12 | /// 13 | /// Extend form JJLogOutput, define the basic field and method 14 | open class JJLogObject: JJLogOutput { 15 | 16 | /// Log level, default value is `.debug` 17 | open var logLevel: JJSwiftLog.Level = .debug 18 | 19 | /// Log queue 20 | open var queue: DispatchQueue? 21 | 22 | /// Log object identifier, will be unique 23 | open var identifier: String 24 | 25 | /// Log object forward internal information to outside 26 | public weak var delegate: JJLogOutputDelegate? 27 | 28 | /// Log format array protocol, option 29 | open var formatters: [JJLogFormatterProtocol]? 30 | 31 | /// Log array filter 32 | open var filters: [JJLogFilter]? 33 | 34 | /// Init JJLogObject 35 | /// - Parameters: 36 | /// - identifier: unique identifier 37 | /// - delegate: internal callback 38 | public init(identifier: String = "", delegate: JJLogOutputDelegate? = nil) { 39 | self.identifier = identifier 40 | self.delegate = delegate 41 | } 42 | 43 | open func log(_ level: JJSwiftLog.Level, msg: String, thread: String, file: String, function: String, line: Int) { 44 | let log = JJLogEntity(level: level, date: Date(), message: msg, functionName: function, fileName: file, lineNumber: line) 45 | 46 | // Format log message 47 | let message = self.formatMessage(level: level, msg: msg, thread: thread, file: file, function: function, line: line) 48 | 49 | /// ------------- Deprecated method --------------------- 50 | // Weather to ignore logs 51 | if self.filter?.ignore(log: log, message: message) == true { 52 | return 53 | } 54 | 55 | let formatMessage = self.formatter?.format(log: log, message: message) 56 | /// ------------- Deprecated method --------------------- 57 | 58 | /// Formatter and filter collection 59 | if let filters = self.filters { 60 | for filter in filters { 61 | if filter.ignore(log: log, message: message) == true { 62 | return 63 | } 64 | } 65 | } 66 | 67 | var formatResult = message 68 | self.formatters?.forEach({ formatter in 69 | formatResult = formatter.format(log: log, message: formatResult) 70 | }) 71 | 72 | /// formatters override formatter 73 | /// 74 | /// formatters is higher priority than formatter 75 | self.output(log: log, message: formatMessage == nil ? formatResult : formatMessage!) 76 | } 77 | 78 | /// Output format message and log object 79 | /// - Parameters: 80 | /// - log: JJLogEntity 81 | /// - message: Format message 82 | open func output(log: JJLogEntity, message: String) { 83 | fatalError("Must Override") 84 | } 85 | 86 | // MARK: - Deprecated 87 | 88 | /// Log format protocol, option 89 | @available(*, deprecated, message: "Please use formatters property") 90 | open var formatter: JJLogFormatterProtocol? 91 | 92 | /// Log filter 93 | @available(*, deprecated, message: "Please use filters property") 94 | open var filter: JJLogFilter? 95 | 96 | } 97 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJLogOutput+Extension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJLogOutput+Extension.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Extension for JJSwiftLog.Level 12 | extension JJSwiftLog.Level { 13 | 14 | /// String level 15 | public var stringLevel: String { 16 | switch self { 17 | case .verbose: 18 | return "VERBOSE" 19 | case .debug: 20 | return "DEBUG" 21 | case .info: 22 | return "INFO" 23 | case .warning: 24 | return "WARN" 25 | case .error: 26 | return "ERROR" 27 | } 28 | } 29 | 30 | /// Emoji level 31 | public var emojiLevel: String { 32 | switch self { 33 | case .verbose: 34 | return "📗" 35 | case .debug: 36 | return "📘" 37 | case .info: 38 | return "📓" 39 | case .warning: 40 | return "📙" 41 | case .error: 42 | return "📕" 43 | } 44 | } 45 | 46 | } 47 | 48 | extension JJLogOutput { 49 | 50 | /// Generate log from log level,thread,file name,function line number 51 | /// - Parameter level: log level 52 | /// - Parameter msg: text 53 | /// - Parameter thread: thread 54 | /// - Parameter file: file name 55 | /// - Parameter function: function 56 | /// - Parameter line: line number 57 | func formatMessage(level: JJSwiftLog.Level, msg: String, thread: String, 58 | file: String, function: String, line: Int) -> String { 59 | if !JJLogFormatter.shared.segments.isEmpty { 60 | return formatSegmentMessage(level: level, msg: msg, thread: thread, file: file, function: function, line: line) 61 | } 62 | var text = "" 63 | text += self.formatDate(JJLogOutputConfig.dateTimezoneformatter) + JJLogOutputConfig.padding 64 | text += level.emojiLevel + JJLogOutputConfig.padding 65 | text += thread.isEmpty ? "" : (thread + JJLogOutputConfig.padding) 66 | if !file.isEmpty { 67 | text += JJLogOutputConfig.fileNameWithoutSuffix(file) + JJLogOutputConfig.point 68 | } 69 | if !function.isEmpty { 70 | text += function + JJLogOutputConfig.padding 71 | } 72 | if line != 0 { 73 | text += "\(line)" + JJLogOutputConfig.padding 74 | } 75 | text += level.stringLevel + JJLogOutputConfig.padding 76 | text += msg 77 | text += JJLogOutputConfig.newline 78 | return text 79 | } 80 | 81 | /// Format segment message 82 | /// - Parameters: 83 | /// - level: Log level 84 | /// - msg: Text message 85 | /// - thread: Thread name 86 | /// - file: File name, suffix extension 87 | /// - function: Function 88 | /// - line: Function line number 89 | /// - Returns: All info string 90 | func formatSegmentMessage(level: JJSwiftLog.Level, msg: String, thread: String, 91 | file: String, function: String, line: Int) -> String { 92 | var text = "" 93 | let segments = JJLogFormatter.shared.segments 94 | for segment in segments { 95 | switch segment { 96 | case .token(let option, let string): 97 | switch option { 98 | case .message: 99 | text += (msg + string) 100 | case .level: 101 | text += (level.stringLevel + string) 102 | case .line: 103 | text += ("\(line)" + string) 104 | case .file: 105 | text += (JJLogOutputConfig.fileNameWithoutSuffix(file) + string) 106 | case .fileExtension: 107 | text += (JJLogOutputConfig.fileNameOfFile(file) + string) 108 | case .function: 109 | text += (function + string) 110 | case .date: 111 | text += (self.formatDate(JJLogOutputConfig.dateTimezoneformatter) + string) 112 | case .onlyDate: 113 | text += (self.formatDate(JJLogOutputConfig.dateFormatter) + string) 114 | case .time: 115 | text += (self.formatDate(JJLogOutputConfig.timeFormatter) + string) 116 | case .thread: 117 | text += thread.isEmpty ? "" : thread 118 | case .origin: 119 | text += string 120 | case .ignore: 121 | text += string 122 | } 123 | } 124 | } 125 | text += JJLogOutputConfig.newline 126 | return text 127 | } 128 | 129 | /// Format date 130 | /// - Parameter dateFormat: Date format 131 | /// - Parameter timeZone: timeZone 132 | func formatDate(_ dateFormat: String, timeZone: String = "") -> String { 133 | 134 | if !timeZone.isEmpty { 135 | JJLogOutputConfig.formatDate.timeZone = TimeZone(abbreviation: timeZone) 136 | } 137 | JJLogOutputConfig.formatDate.dateFormat = dateFormat 138 | let dateStr = JJLogOutputConfig.formatDate.string(from: Date()) 139 | return dateStr 140 | } 141 | 142 | /// Write string to filepointer 143 | /// - Parameter string: string 144 | /// - Parameter filePointer: UnsafeMutablePointer 145 | func writeStringToFile(_ string: String, filePointer: UnsafeMutablePointer) { 146 | string.withCString { ptr in 147 | 148 | #if os(Windows) 149 | _lock_file(filePointer) 150 | #else 151 | flockfile(filePointer) 152 | #endif 153 | defer { 154 | #if os(Windows) 155 | _unlock_file(filePointer) 156 | #else 157 | funlockfile(filePointer) 158 | #endif 159 | } 160 | 161 | _ = fputs(ptr, filePointer) 162 | _ = fflush(filePointer) 163 | } 164 | } 165 | 166 | } 167 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJLogOutput.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJLogOutput.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// Constant value 12 | internal struct JJLogOutputConfig { 13 | 14 | static let padding = " " 15 | 16 | static let dateTimezoneformatter = "yyyy-MM-dd HH:mm:ss.SSSZ" 17 | 18 | static let timeFormatter = "HH:mm:ss" 19 | 20 | static let dateFormatter = "yyyy-MM-dd" 21 | 22 | static let formatDate = DateFormatter() 23 | 24 | static let newline = "\n" 25 | 26 | static let point = "." 27 | 28 | /// Get file name from file string 29 | /// - Parameter file: File path 30 | static func fileNameOfFile(_ file: String) -> String { 31 | let fileParts = file.components(separatedBy: "/") 32 | if let lastPart = fileParts.last { 33 | return lastPart 34 | } 35 | return "" 36 | } 37 | 38 | /// Get file name with out suffix 39 | /// - Parameter file: File path 40 | static public func fileNameWithoutSuffix(_ file: String) -> String { 41 | let fileName = fileNameOfFile(file) 42 | 43 | if !fileName.isEmpty { 44 | let fileNameParts = fileName.components(separatedBy: ".") 45 | if let firstPart = fileNameParts.first { 46 | return firstPart 47 | } 48 | } 49 | return "" 50 | } 51 | } 52 | 53 | /// JJLogOutput callback 54 | public protocol JJLogOutputDelegate: AnyObject { 55 | 56 | /// SDK special log message 57 | func internalLog(source: JJLogOutput, log: JJLogEntity) 58 | } 59 | 60 | /// Abstract log 61 | /// 62 | /// Log,(Console),(File), (Network) 63 | 64 | public protocol JJLogOutput { 65 | 66 | /// queue, customer's DispatchQueue 67 | /// 68 | /// If queue != nil , will process async queue 69 | /// If queue == nil , will process current queue 70 | var queue: DispatchQueue? { 71 | get 72 | } 73 | 74 | /// Handle log 75 | /// - Parameter level: level 76 | /// - Parameter msg: Log message 77 | /// - Parameter thread: thread 78 | /// - Parameter file: file name 79 | /// - Parameter function: funcation name 80 | /// - Parameter line: source line 81 | func log(_ level: JJSwiftLog.Level, msg: String, thread: String, file: String, function: String, line: Int) 82 | 83 | /// Log level 84 | var logLevel: JJSwiftLog.Level { 85 | get 86 | set 87 | } 88 | 89 | /// Object identifier, override the equals, defalut value is current object name 90 | var identifier: String { 91 | get 92 | } 93 | 94 | /// JJLogOutput object callback 95 | var delegate: JJLogOutputDelegate? { 96 | get 97 | set 98 | } 99 | 100 | /// Execute all formatters,formatted result one by one 101 | var formatters: [JJLogFormatterProtocol]? { 102 | get 103 | set 104 | } 105 | 106 | /// Execute all filters,if a filter return true, this log will end 107 | var filters: [JJLogFilter]? { 108 | get 109 | set 110 | } 111 | 112 | /// Format log 113 | @available(*, deprecated, message: "Use formatters property instead") 114 | var formatter: JJLogFormatterProtocol? { 115 | get 116 | set 117 | } 118 | 119 | /// Filt log 120 | @available(*, deprecated, message: "Use filters property instead") 121 | var filter: JJLogFilter? { 122 | get 123 | set 124 | } 125 | 126 | } 127 | 128 | public extension JJLogOutput { 129 | 130 | /// Identifier value is object name 131 | var identifier: String { 132 | return String(describing: type(of: self)) 133 | } 134 | 135 | } 136 | 137 | /// Check JJLogOutput implment object only one 138 | /// - Parameter lhs: JJLogOutput 139 | /// - Parameter rhs: JJLogOutput 140 | func == (lhs: JJLogOutput, rhs: JJLogOutput) -> Bool { 141 | return lhs.identifier == rhs.identifier 142 | } 143 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJSentryOutput.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJUmengOutput.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2022/2/12. 6 | // Copyright © 2022 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | #if os(iOS) 11 | import UIKit 12 | #endif 13 | 14 | /// Send log to the Sentry 15 | /// 16 | /// Send log result success is`completion` and failed is `failure` 17 | /// And Must config the url,key 18 | open class JJSentryOutput: JJLogObject { 19 | 20 | /// Success closure 21 | public var completion: (([String: Any]) -> Void)? 22 | 23 | /// Failed closure 24 | public var failure: ((Error) -> Void)? 25 | 26 | /// Sentry auth key 27 | private let sentryKey: String 28 | 29 | /// Sentry URL 30 | private let sentryURL: URL 31 | 32 | /// Config user id, this config is option 33 | private var userId: String? 34 | 35 | /// Init for JJSentryOutput 36 | /// - Parameters: 37 | /// - sentryKey: Http header key is X-Sentry-Auth 38 | /// - sentryHost: Customer sentry private url, example: https://xxx.xx.xx/api/5/store/ 39 | /// - userId: Optional user id 40 | /// - delegate: Internal log 41 | public init(sentryKey: String, sentryURL: URL, userId: String? = nil, delegate: JJLogOutputDelegate? = nil) { 42 | self.sentryKey = sentryKey 43 | self.sentryURL = sentryURL 44 | self.userId = userId 45 | super.init(identifier: "JJSentryOutput", delegate: delegate) 46 | } 47 | 48 | open override func output(log: JJLogEntity, message: String) { 49 | self.sendJSONRequest(parameters: self.sentryJSONParameters(message: message)) 50 | } 51 | } 52 | 53 | extension JJSentryOutput { 54 | 55 | /// Wrap the message to Dictionary 56 | /// - Parameter message: Format message 57 | /// - Returns: Format message result 58 | public func sentryJSONParameters(message: String) -> [String: Any] { 59 | 60 | let appInfo = self.currentAppInfo() 61 | 62 | var parameters = [String: Any]() 63 | // parameters["extra"] = nil 64 | parameters["event_id"] = UUID().uuidString.replacingOccurrences(of: "-", with: "").lowercased() 65 | parameters["message"] = message 66 | parameters["release"] = appInfo["app_identifier"] 67 | parameters["level"] = self.logLevel.stringLevel 68 | parameters["platform"] = "cocoa" 69 | parameters["sdk"] = ["name": "zg-sentry-cocoa", "version": "0.0.1"] 70 | 71 | if let userId = self.userId { 72 | parameters["user"] = ["id": userId] 73 | } 74 | #if os(iOS) 75 | let systemVersion = UIDevice.current.systemVersion 76 | let model = UIDevice.current.model + UIDevice.current.systemName + UIDevice.current.systemVersion 77 | 78 | parameters["contexts"] = ["os": ["name": UIDevice.current.systemName, "version": systemVersion], "app": self.currentAppInfo(), "device": ["model": model]] 79 | #else 80 | parameters["contexts"] = ["app": self.currentAppInfo()] 81 | #endif 82 | return parameters 83 | } 84 | 85 | /// Send parameters by the http post 86 | /// - Parameter parameters: HTTP post parameters 87 | public func sendJSONRequest(parameters: [String: Any]) { 88 | 89 | let timestamp: Int = Int(Date().timeIntervalSince1970) 90 | 91 | let jsonData = try? JSONSerialization.data(withJSONObject: parameters, options: .prettyPrinted) 92 | 93 | var request = URLRequest(url: self.sentryURL, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: 20) 94 | request.httpMethod = "POST" 95 | request.httpBody = jsonData 96 | request.addValue("application/json", forHTTPHeaderField: "Content-Type") 97 | request.addValue("sentry-cocoa", forHTTPHeaderField: "User-Agent") 98 | request.addValue("Sentry sentry_version=7,sentry_client=sentry-cocoa/4.5.0,sentry_timestamp=\(timestamp),sentry_key=\(self.sentryKey)", forHTTPHeaderField: "X-Sentry-Auth") 99 | 100 | let task = URLSession.shared.dataTask(with: request) { [weak self] (data, _, error) in 101 | guard let strongSelf = self else { 102 | return 103 | } 104 | guard let data = data else { 105 | strongSelf.handleError(message: "Http get data failed") 106 | return 107 | } 108 | 109 | guard error == nil else { 110 | strongSelf.handleError(message: error!.localizedDescription) 111 | return 112 | } 113 | 114 | guard let jsonResult = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any] else { 115 | strongSelf.handleError(message: "Convert data to JSON failed") 116 | return 117 | } 118 | 119 | if jsonResult["id"] == nil { 120 | strongSelf.completion?(jsonResult) 121 | } else { 122 | strongSelf.handleError(message: "Post log error, response is \(jsonResult)") 123 | } 124 | } 125 | 126 | task.resume() 127 | } 128 | 129 | func handleError(message: String) { 130 | self.failure?(NSError(domain: "sentry.error", code: 0, userInfo: [NSLocalizedDescriptionKey: message])) 131 | let log = JJLogEntity(level: .info, date: Date(), message: message, functionName: "", fileName: "", lineNumber: 0) 132 | self.delegate?.internalLog(source: self, log: log) 133 | } 134 | 135 | /// App info 136 | /// - Returns: App Dictionary info 137 | public func currentAppInfo() -> [String: Any] { 138 | var appInfo = [String: Any]() 139 | let infoDictionary = Bundle.main.infoDictionary 140 | appInfo["app_identifier"] = infoDictionary?["CFBundleIdentifier"] 141 | appInfo["app_name"] = infoDictionary?["CFBundleName"] 142 | appInfo["app_build"] = infoDictionary?["CFBundleVersion"] 143 | appInfo["app_version"] = infoDictionary?["CFBundleShortVersionString"] 144 | return appInfo 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /JJSwiftLog/Source/JJSwiftLog.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJSwiftLog.swift 3 | // JJSwiftLog: https://github.com/jezzmemo/JJSwiftLog 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /// New JJSwiftLog short name 12 | public let JJLogger = JJSwiftLog.default 13 | 14 | /// JJSwiftLog main 15 | /// 16 | /// JJSwiftLog(Console,File,Network),Support customer process the log 17 | open class JJSwiftLog { 18 | 19 | /// Constants variable 20 | public struct Constants { 21 | /// Lib version number 22 | public static let version = "0.1.3" 23 | /// Internal console 24 | public static let internalConsoleIdentifier = "log.internal.console" 25 | /// Normal console 26 | public static let normalConsoleIdentifier = "log.normal.console" 27 | /// File 28 | public static let fileIdentifier = "log.file" 29 | } 30 | 31 | var logLevel: Level = .debug 32 | 33 | /// Log level 34 | public enum Level: Int, CaseIterable { 35 | case verbose = 0 36 | case debug = 1 37 | case info = 2 38 | case warning = 3 39 | case error = 4 40 | } 41 | 42 | // MARK: - Property 43 | 44 | private var outputs = [JJLogOutput]() 45 | 46 | private let semaphore = DispatchSemaphore(value: 1) 47 | 48 | private var onlyShowLogFileName: String? 49 | 50 | // MARK: - Public 51 | 52 | /// Default enable log 53 | public var enable = true 54 | 55 | /// Customer log format, default is nil 56 | public var format: String? { 57 | didSet { 58 | if self.format != nil { 59 | JJLogFormatter.shared.formatLog(format!) 60 | } 61 | } 62 | } 63 | 64 | /// Simple log format 65 | public static let simpleFormat = "%D -> %F:%l - %f %M" 66 | 67 | /// Default instance, developer can alloc it by self 68 | public static let `default` = JJSwiftLog() 69 | 70 | /// Init JJSwiftLog 71 | /// - Parameter needDefaultOutput: Default output to show lib message log 72 | public init(needDefaultOutput: Bool = true) { 73 | if needDefaultOutput { 74 | let console = JJConsoleOutput(identifier: Constants.internalConsoleIdentifier) 75 | console.isUseNSLog = false 76 | console.logLevel = .debug 77 | self.addLogOutput(console) 78 | } 79 | } 80 | 81 | /// Simple setup,quick tourist 82 | /// - Parameters: 83 | /// - level: JJSwiftLog.Level, default is debug level 84 | /// - fileLevel: JJSwiftLog.Level option type 85 | /// - filePath: Save file log `String` path 86 | open func setup(level: JJSwiftLog.Level = .debug, fileLevel: JJSwiftLog.Level? = nil, filePath: String? = nil) { 87 | logLevel = level 88 | 89 | self.startLogInfo() 90 | 91 | let console = JJConsoleOutput(identifier: Constants.normalConsoleIdentifier) 92 | console.isUseNSLog = false 93 | console.logLevel = level 94 | self.addLogOutput(console) 95 | 96 | if let file = JJFileOutput(filePath: filePath, delegate: self, identifier: Constants.fileIdentifier) { 97 | file.logLevel = fileLevel ?? level 98 | self.addLogOutput(file) 99 | } 100 | } 101 | 102 | /// Add customer process log 103 | /// - Parameter output: JJLogOutput 104 | public func addLogOutput(_ output: JJLogOutput) { 105 | semaphore.wait() 106 | defer { 107 | semaphore.signal() 108 | } 109 | let index = outputs.firstIndex(where: { (out) -> Bool in 110 | return out == output 111 | }) 112 | if index == nil { 113 | outputs.append(output) 114 | } 115 | } 116 | 117 | /// Remove customer JJLogOutput 118 | /// - Parameter output: JJLogOutput 119 | public func removeLogOutput(_ output: JJLogOutput) { 120 | semaphore.wait() 121 | defer { 122 | semaphore.signal() 123 | } 124 | let index = outputs.firstIndex(where: { (out) -> Bool in 125 | return out == output 126 | }) 127 | if index != nil { 128 | outputs.remove(at: index!) 129 | } 130 | } 131 | 132 | /// Process only show log file 133 | /// - Parameter filename: File name without suffix 134 | public func onlyLogFile(_ filename: String) { 135 | onlyShowLogFileName = filename 136 | } 137 | 138 | // MARK: - Log Level 139 | 140 | /// Verbose 141 | /// - Parameter message: message 142 | @inlinable 143 | public func verbose(_ message: @autoclosure() -> Any, file: String = #file, function: String = #function, line: Int = #line) { 144 | custom(level: .verbose, message: message(), file: file, function: function, line: line) 145 | } 146 | 147 | /// Debug 148 | /// - Parameter message: message 149 | @inlinable 150 | public func debug(_ message: @autoclosure() -> Any, file: String = #file, function: String = #function, line: Int = #line) { 151 | custom(level: .debug, message: message(), file: file, function: function, line: line) 152 | } 153 | 154 | /// Info 155 | /// - Parameter message: message 156 | @inlinable 157 | public func info(_ message: @autoclosure() -> Any, file: String = #file, function: String = #function, line: Int = #line) { 158 | custom(level: .info, message: message(), file: file, function: function, line: line) 159 | } 160 | 161 | /// Warn 162 | /// - Parameter message: message 163 | @inlinable 164 | public func warning(_ message: @autoclosure() -> Any, file: String = #file, function: String = #function, line: Int = #line) { 165 | custom(level: .warning, message: message(), file: file, function: function, line: line) 166 | } 167 | 168 | /// Error 169 | /// - Parameter message: message 170 | @inlinable 171 | public func error(_ message: @autoclosure() -> Any, file: String = #file, function: String = #function, line: Int = #line) { 172 | custom(level: .error, message: message(), file: file, function: function, line: line) 173 | } 174 | 175 | /// Customer log 176 | /// - Parameter level: level 177 | /// - Parameter message: message 178 | /// - Parameter file: file 179 | /// - Parameter function: function 180 | /// - Parameter line: line 181 | public func custom(level: JJSwiftLog.Level, message: Any, file: String = #file, function: String = #function, line: Int = #line) { 182 | 183 | /// Filter onlyShowLogFileName 184 | if let fileName = onlyShowLogFileName, JJLogOutputConfig.fileNameWithoutSuffix(file) != fileName { 185 | return 186 | } 187 | 188 | if !enable { 189 | return 190 | } 191 | 192 | let threadName = self.threadName() 193 | let resultMessage = "\(message)" 194 | 195 | for output in outputs { 196 | if output.identifier == Constants.internalConsoleIdentifier { 197 | continue 198 | } 199 | if output.logLevel.rawValue > level.rawValue { 200 | continue 201 | } 202 | if let outputQueue = output.queue { 203 | outputQueue.async { 204 | output.log(level, msg: resultMessage, thread: threadName, file: file, function: function, line: line) 205 | } 206 | } else { 207 | output.log(level, msg: resultMessage, thread: threadName, file: file, function: function, line: line) 208 | } 209 | } 210 | } 211 | } 212 | 213 | extension JJSwiftLog: JJLogOutputDelegate { 214 | 215 | public func internalLog(source: JJLogOutput, log: JJLogEntity) { 216 | internalOutputLog()?.log(log.level, msg: log.message, thread: "", file: log.fileName, function: log.functionName, line: log.lineNumber) 217 | } 218 | 219 | } 220 | 221 | extension JJSwiftLog { 222 | 223 | func internalOutputLog() -> JJLogOutput? { 224 | for output in outputs where output.identifier == Constants.internalConsoleIdentifier { 225 | return output 226 | } 227 | return nil 228 | } 229 | 230 | func threadName() -> String { 231 | guard !Thread.isMainThread else { 232 | return "main" 233 | } 234 | 235 | let threadName = Thread.current.name 236 | if let threadName = threadName, !threadName.isEmpty { 237 | return threadName 238 | } else if let queueName = String(validatingUTF8: __dispatch_queue_get_label(nil)), !queueName.isEmpty { 239 | return queueName 240 | } else { 241 | return String(format: "%p", Thread.current) 242 | } 243 | } 244 | 245 | /// If add JJLogOutput by manual, developer recommend to call this method 246 | public func startLogInfo() { 247 | 248 | var buildString = "\(ProcessInfo.processInfo.processName) " 249 | if let infoDictionary = Bundle.main.infoDictionary { 250 | if let CFBundleShortVersionString = infoDictionary["CFBundleShortVersionString"] as? String { 251 | buildString += "Version: \(CFBundleShortVersionString) " 252 | } 253 | if let CFBundleVersion = infoDictionary["CFBundleVersion"] as? String { 254 | buildString += "Build: \(CFBundleVersion) " 255 | } 256 | } 257 | 258 | let libVersion = JJSwiftLog.Constants.version 259 | var logs = [String]() 260 | let appInfo = ">>> \(buildString)PID: \(ProcessInfo.processInfo.processIdentifier)" 261 | let libInfo = ">>> JJSwiftLog Version: \(libVersion) - Log Level: \(logLevel)" 262 | logs.append(appInfo) 263 | logs.append(libInfo) 264 | 265 | logs.forEach { message in 266 | internalOutputLog()?.log(.info, msg: message, thread: "", file: "", function: "", line: 0) 267 | } 268 | } 269 | 270 | } 271 | 272 | /// JJSwiftLog short name 273 | @available(*, deprecated, message: "Please replace by JJLogger") 274 | public let jjLogger = JJSwiftLog.self 275 | -------------------------------------------------------------------------------- /JJSwiftLog/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // JJSwiftLog 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJ. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | func setupLog() { 14 | 15 | } 16 | 17 | func setupVendor(parameter: String) { 18 | JJLogger.verbose("method set the parameter") 19 | } 20 | 21 | override func viewDidLoad() { 22 | super.viewDidLoad() 23 | JJLogger.setup(level: .verbose) 24 | 25 | JJLogger.format = JJSwiftLog.simpleFormat 26 | // JJLogger.onlyLogFile("ViewController") 27 | 28 | JJLogger.verbose("verbose") 29 | JJLogger.debug("debug") 30 | JJLogger.info("info") 31 | JJLogger.warning("warn") 32 | JJLogger.error("error") 33 | 34 | JJLogger.verbose(123) 35 | JJLogger.debug(1.2) 36 | JJLogger.info(Date()) 37 | JJLogger.warning(["1", "2"]) 38 | 39 | JJLogger.enable = true 40 | 41 | setupLog() 42 | setupVendor(parameter: "Show the error log") 43 | JJLogger.verbose("Start the record") 44 | JJLogger.debug("Debug the world") 45 | JJLogger.info("Show log info") 46 | JJLogger.warning("Build warning") 47 | JJLogger.error("can’t fetch user info without user id") 48 | 49 | let button = UIButton(type: .custom) 50 | button.setTitle("Add log", for: .normal) 51 | button.addTarget(self, action: #selector(clickButton), for: .touchUpInside) 52 | button.setTitleColor(.red, for: .normal) 53 | button.frame = CGRect(x: 0, y: 200, width: 200, height: 50) 54 | self.view.addSubview(button) 55 | } 56 | 57 | func advanceUsage() { 58 | let file = JJFileOutput(delegate: JJLogger, identifier: "file") 59 | if file != nil { 60 | file?.targetMaxFileSize = 1000 * 1024 61 | file?.targetMaxTimeInterval = 600 62 | file?.targetMaxLogFiles = 20 63 | file?.formatters = [JJFormatterLogANSIColor()] 64 | JJLogger.addLogOutput(file!) 65 | } 66 | #if DEBUG 67 | let console = JJConsoleOutput(identifier: "console") 68 | console.isUseNSLog = false 69 | JJLogger.addLogOutput(console) 70 | #endif 71 | JJLogger.startLogInfo() 72 | } 73 | 74 | func sentryUsage() { 75 | let sentry = JJSentryOutput(sentryKey: "key", sentryURL: URL(string: "http://www.exmaple.com/api/5/store/")!, delegate: JJLogger) 76 | sentry.completion = { result in 77 | 78 | } 79 | sentry.failure = { error in 80 | 81 | } 82 | JJLogger.addLogOutput(sentry) 83 | } 84 | 85 | @objc func clickButton() { 86 | JJLogger.verbose("Start the record") 87 | JJLogger.debug("Debug the world") 88 | JJLogger.info("Show log info") 89 | JJLogger.warning("Build warning") 90 | JJLogger.error("can’t fetch user info without user id") 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /JJSwiftLogCarthage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /JJSwiftLogCarthage/JJSwiftLogCarthage.h: -------------------------------------------------------------------------------- 1 | // 2 | // JJSwiftLogCarthage.h 3 | // JJSwiftLogCarthage 4 | // 5 | // Created by Jezz on 2019/12/30. 6 | // Copyright © 2019 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for JJSwiftLogCarthage. 12 | FOUNDATION_EXPORT double JJSwiftLogCarthageVersionNumber; 13 | 14 | //! Project version string for JJSwiftLogCarthage. 15 | FOUNDATION_EXPORT const unsigned char JJSwiftLogCarthageVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /JJSwiftLogCarthageTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /JJSwiftLogCarthageTests/JJSwiftLogCarthageTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJSwiftLogCarthageTests.swift 3 | // JJSwiftLogCarthageTests 4 | // 5 | // Created by Jezz on 2019/12/30. 6 | // Copyright © 2019 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JJSwiftLogCarthage 11 | 12 | class JJSwiftLogCarthageTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /JJSwiftLogPrinciple.md: -------------------------------------------------------------------------------- 1 | # JJSwiftLog设计文档 2 | 3 | 在开发这个库的时候,我们要给它设定一个目标,这个日志库给我们解决什么问题,为什么需要一个日志库来辅助我们开发,以及日志库的价值是什么,我总结的以下几个点: 4 | 5 | * 调试开发 6 | 7 | 开发阶段输出辅助开发的重要信息,帮助快速定位信息,提高查找问题的效率,同时也要展示重要信息 8 | 9 | * 排除线上问题 10 | 11 | 日志会记录重要路径的信息,以及记录各类错误信息,排查问题除了debug之外的有效手段 12 | 13 | * 记录重要信息 14 | 15 | 各个业务都会记录重要信息给日志,让日志库保存到我们想保存的位置,方便我们查看和分析 16 | 17 | # 问题 18 | 19 | 日志库需要注意的问题: 20 | 21 | * I/O和CPU的占有率问题,尽可能的减少对系统的影响,让接入方对这点没有顾虑 22 | 23 | * 性能问题,作为日志库不希望影响整体app的流畅度,能快速处理所有情况,这个是对日志库的基本要求 24 | 25 | * 稳定性,这也是日志库的基本要求 26 | 27 | * 安全性,本地存储或者网络存储需要注意的问题,来保证信息不被泄露和篡改 28 | 29 | ## 架构位置和冗余设计 30 | 31 | 日志应该是最基础的库之一,应该是最底层的库,供底层和业务服务,从层次来说应该再最下面,当然如果有些库想不依赖的特殊情况除外,因为下面会提到安全和网络这块,我的理解是这块可能需要我们通过冗余的设计来解决依赖的问题,来保证日志库的内聚,尽量减少外部耦合,让接入者感受到轻量,但是在使用时功能恰到好处,这就是我对日志库设计原则。 32 | 33 | __架构图的几个细节请注意:__ 34 | 35 | 1. 带有虚线的Domain Log(领域Log/特定功能Log),这个是根据实际情况来决定,非必须的 36 | 2. 最下面标出Platform是给日志预留了可能需要跨平台的可能,还可以进一步提高性能 37 | 38 | ![JJSwiftLog architecture](https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/master/screenshots/architecture.png) 39 | 40 | ## 日志性能 41 | 42 | * NSLOG 43 | 44 | ASL, 通过client connection发送日志,device console AND the debugger console 45 | 46 | * os_log 47 | 48 | iOS 10以后才提供的,提供多种日志级别,需要import os,device console AND the debugger console 49 | 50 | * Swift的print 51 | 52 | 只会显示在debug console,其原理还是通过包装的API,最终调用putchar来展示到终端的 53 | 54 | * stdout, stderr 55 | 56 | 根据UNIX的一切皆为文件的特性,任何进程都有一个输入,stdout和stderr两个输出, 可根据日志级别对应输出,一般用于Console 57 | 58 | * TTY 59 | 60 | 可以将日志输出到终端设备上,暂时不考虑 61 | 62 | 63 | 目前来说,主要是完成Console和File功能,在考虑性能的时候,一个要了解每个选型背后的原理,这样你才能准确评估它的空间有多大,我在评估的时候考虑因素: 64 | 65 | 1. 技术选型实现原理 66 | 2. 技术选型所在的层次 67 | 3. 兼容和历史问题 68 | 69 | ### Console(控制台) 70 | 71 | 最终是选了stdout, stderr来实现输出到终端,本身stdout是和application绑定的,而且系统层次较低,通过UNIX的C函数来实现,而且本身带有Buffer功能,所以最终选用它来展示到终端 72 | 73 | ### File(文件) 74 | 75 | 文件主要主要了两个方案: 76 | 77 | * FILE 78 | 79 | 这种就是偏C底层的API,操作方式比较原始,相对于封装的API性能更高,而且本场景的特征是小文件存储,所以这个API相对比较合适 80 | 81 | * MMAP 82 | 83 | MMAP是对性能提出更高的要求时,可以使用这个方案,不过它对使用者的要求相对较高,这里我就不展开讲,[详细介绍在这里](https://www.cnblogs.com/huxiao-tee/p/4660352.html) 84 | 85 | ## 日志库稳定性 86 | 87 | 为什么会提到这点,是以为他的使用频率和使用场景多,所以日志库在稳定性要求是很高的,接入者是不能接受出bug的可能性,所以我们要保证自己的稳定性,提出相对比较高的要求,平时我们是如何做到的: 88 | 89 | 1. 架构设计要通过核心开发人员评审 90 | 2. PR代码最少需要两位高级开发人员review 91 | 3. 要求写UnitTest,逐步提高覆盖率 92 | 4. 比较大的调整通过业务方的灰度发布 93 | 94 | ## 日志安全性 95 | 96 | > 安全是相对的,没有绝对的 97 | 98 | 本次持久化和网络存储都需要注意数据安全问题,常规的应对方法是: 99 | 100 | * 对称加密(DES、3DES、DESX、Blowfish、IDEA、RC4、RC5、RC6、AES。 DES. DES) 101 | 102 | * 非对称加密(RSA、Elgamal、背包算法、Rabin、D-H、ECC) 103 | 104 | 通过以上的手段,当日志在存储和传输时,都需要将信息通过Key来恢复,每个公司对这个重视程度不一样,所以这部分根据自己实际情况来实现,不过强烈建议还是需要加密下,来保证数据的安全 105 | 106 | # 扩展部分说明 107 | 108 | **以下部分暂未实现,但是不影响我们对技术的讨论和学习,所以以下部分是记录我对这些功能的理解和学习,假如后续需要实现,只是编码的过程,不需要再花时间去研究,也有可能需要更新下最新的知识,原理是大同小异的。** 109 | 110 | ## 日志分片(扩展) 111 | 112 | 为什么需要日志分片,因为日志在持久化的过程中,需要将所有记录的日志还原,所以需要将日志按照一定的分片策略存储,再按照既定的规则还原日志原来的面貌。 113 | 114 | 生成日志文件的规则是:时间+设备指纹+(用户Id可选) 115 | 116 | 分片的依据条件是: 117 | 118 | * 文件大小 119 | * 生成文件的间隔 120 | 121 | 这是常规的条件,还可以根据自己的业务特色,来灵活定义,这个没有统一的规则。 122 | 123 | ## 日志回捞(扩展) 124 | 125 | 日志回捞解决的场景是,客户端错过了上传日志的窗口,需要一种随时可以获取用户日志的需求,这里面需要用到长连技术来辅助达到目的,如果公司内部没有,可以用极光类似的SDK替代。 126 | 127 | 获取日志的方式: 128 | 129 | * App启动的时候上报 130 | * App启动后按照规则来上传 131 | * 通过Push来被动上传 132 | 133 | 对于iOS来说有个问题需要解决,如果App处于杀死状态或者挂起状态,需要获取用户日志,目前有两种不是很完美的方案: 134 | 135 | 1. App有后台权限,可以保持App一直active 136 | 2. Notification Service Extension,让日志共享,可以用这个服务来上传,而且需要是静默状态下,__一切的前提是用户同意收推送__ 137 | 138 | [https://github.com/jezzmemo/JJSwiftLog](https://github.com/jezzmemo/JJSwiftLog) 139 | 140 | # 参考 141 | 142 | [https://github.com/DaveWoodCom/XCGLogger](https://github.com/DaveWoodCom/XCGLogger) 143 | 144 | [SwiftyBeaver](https://github.com/SwiftyBeaver/SwiftyBeaver) 145 | 146 | [https://github.com/emaloney/CleanroomLogger](https://github.com/emaloney/CleanroomLogger) 147 | 148 | [Swift print](https://github.com/sukeyang/blog-2/blob/master/articles/swift-print.md) -------------------------------------------------------------------------------- /JJSwiftLogTests/FormatterTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FormatterTests.swift 3 | // JJSwiftLogTests 4 | // 5 | // Created by Jezz on 2022/2/6. 6 | // Copyright © 2022 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JJSwiftLog 11 | 12 | class FormatterTests: XCTestCase { 13 | 14 | override func setUpWithError() throws { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDownWithError() throws { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | class Formatter1: JJLogFormatterProtocol { 23 | func format(log: JJLogEntity, message: String) -> String { 24 | return "123" + message 25 | } 26 | } 27 | 28 | class Formatter2: JJLogFormatterProtocol { 29 | func format(log: JJLogEntity, message: String) -> String { 30 | return message + "456" 31 | } 32 | } 33 | 34 | class CustomerFormatterLog: JJLogObject { 35 | override func output(log: JJLogEntity, message: String) { 36 | XCTAssertTrue(message.hasPrefix("123")) 37 | XCTAssertTrue(message.hasSuffix("456")) 38 | } 39 | } 40 | 41 | func testFormatter() { 42 | let customtLog = CustomerFormatterLog(identifier: "CustomerFilterLog", delegate: nil) 43 | customtLog.formatters = [Formatter1(), Formatter2()] 44 | JJLogger.addLogOutput(customtLog) 45 | 46 | JJLogger.debug("any") 47 | } 48 | 49 | class Formatter3: JJLogFormatterProtocol { 50 | func format(log: JJLogEntity, message: String) -> String { 51 | return "" 52 | } 53 | } 54 | 55 | class CustomerFormatterLog1: JJLogObject { 56 | override func output(log: JJLogEntity, message: String) { 57 | XCTAssertTrue(message == "") 58 | } 59 | } 60 | 61 | func testEmptyFormatter() { 62 | let customtLog = CustomerFormatterLog1(identifier: "CustomerFilterLog1", delegate: nil) 63 | customtLog.formatters = [Formatter3()] 64 | JJLogger.addLogOutput(customtLog) 65 | 66 | JJLogger.debug("any") 67 | } 68 | 69 | class Formatter4: JJLogFormatterProtocol { 70 | func format(log: JJLogEntity, message: String) -> String { 71 | return "123" 72 | } 73 | } 74 | 75 | class CustomerFormatterLog2: JJLogObject { 76 | override func output(log: JJLogEntity, message: String) { 77 | XCTAssertTrue(message == "123") 78 | } 79 | } 80 | 81 | func testReplaceFormatter() { 82 | let customtLog = CustomerFormatterLog2(identifier: "CustomerFilterLog2") 83 | customtLog.formatters = [Formatter4()] 84 | JJLogger.addLogOutput(customtLog) 85 | 86 | JJLogger.debug("any") 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /JJSwiftLogTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | NSAppTransportSecurity 22 | 23 | NSAllowsArbitraryLoads 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /JJSwiftLogTests/JJSwiftLogTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JJSwiftLogTests.swift 3 | // JJSwiftLogTests 4 | // 5 | // Created by Jezz on 2019/12/27. 6 | // Copyright © 2019 JJ. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import JJSwiftLog 11 | 12 | class JJSwiftLogTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testJJLogOutput() { 23 | XCTAssertTrue(JJLogOutputConfig.fileNameOfFile("/test/test.suffix") == "test.suffix") 24 | XCTAssertTrue(JJLogOutputConfig.fileNameOfFile("/test/test") == "test") 25 | XCTAssertTrue(JJLogOutputConfig.fileNameOfFile("/test/") == "") 26 | XCTAssertTrue(JJLogOutputConfig.fileNameOfFile("/test") == "test") 27 | XCTAssertTrue(JJLogOutputConfig.fileNameOfFile("") == "") 28 | 29 | XCTAssertTrue(JJLogOutputConfig.fileNameWithoutSuffix("/test/test.suffix") == "test") 30 | XCTAssertTrue(JJLogOutputConfig.fileNameWithoutSuffix("/test/test") == "test") 31 | XCTAssertTrue(JJLogOutputConfig.fileNameWithoutSuffix("/test/") == "") 32 | XCTAssertTrue(JJLogOutputConfig.fileNameWithoutSuffix("") == "") 33 | } 34 | 35 | func testLogFormat() { 36 | // JJLogFormatter.shared.formatLog("") 37 | // XCTAssertTrue(JJLogFormatter.shared.segments.isEmpty) 38 | 39 | JJLogFormatter.shared.formatLog("1") 40 | XCTAssert(JJLogFormatter.shared.segments.count == 1) 41 | 42 | JJLogFormatter.shared.formatLog("%M") 43 | XCTAssert(JJLogFormatter.shared.segments.count == 2) 44 | } 45 | 46 | class Filter1: JJLogFilter { 47 | func ignore(log: JJLogEntity, message: String) -> Bool { 48 | return log.message == "123" 49 | } 50 | } 51 | 52 | class Filter2: JJLogFilter { 53 | func ignore(log: JJLogEntity, message: String) -> Bool { 54 | return false 55 | } 56 | } 57 | 58 | class CustomerFilterLog: JJLogObject { 59 | override func output(log: JJLogEntity, message: String) { 60 | XCTAssertTrue(log.message == "456") 61 | } 62 | } 63 | 64 | func testLogFilters() { 65 | let customtLog = CustomerFilterLog(identifier: "test1", delegate: nil) 66 | customtLog.filters = [Filter1(), Filter2()] 67 | JJLogger.addLogOutput(customtLog) 68 | 69 | JJLogger.debug("123") 70 | JJLogger.debug("456") 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /JJSwiftLogTests/SentryTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SentryTests.swift 3 | // JJSwiftLogTests 4 | // 5 | // Created by Jezz on 2022/2/20. 6 | // Copyright © 2022 JJSwiftLog. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | import JJSwiftLog 11 | 12 | class SentryTests: XCTestCase { 13 | 14 | override func setUpWithError() throws { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDownWithError() throws { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testSentryFailure() throws { 23 | let expectation = XCTestExpectation(description: "Chops the vegetables") 24 | 25 | let sentry = JJSentryOutput(sentryKey: "124", sentryURL: URL(string: "https://www.baidu.com")!) 26 | sentry.failure = { _ in 27 | expectation.fulfill() 28 | } 29 | JJLogger.addLogOutput(sentry) 30 | JJLogger.info("any") 31 | wait(for: [expectation], timeout: 5) 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 jezz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.0 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "JJSwiftLog", 8 | platforms: [ 9 | .iOS(.v9), 10 | .macOS(.v10_13), 11 | .tvOS(.v9), 12 | .watchOS(.v2) 13 | ], 14 | products: [ 15 | .library(name: "JJSwiftLog", targets: ["JJSwiftLog"]) 16 | ], 17 | targets: [ 18 | .target(name: "JJSwiftLog", path: "JJSwiftLog/Source"), 19 | ], 20 | swiftLanguageVersions: [.v5] 21 | ) -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '9.0' 3 | 4 | source 'https://github.com/CocoaPods/Specs.git' 5 | 6 | target 'JJSwiftLog' do 7 | # Comment the next line if you don't want to use dynamic frameworks 8 | use_frameworks! 9 | 10 | #pod 'Bugly' 11 | #pod 'UMCAnalytics' 12 | 13 | target 'JJSwiftLogCarthageTests' do 14 | inherit! :search_paths 15 | # Pods for testing 16 | end 17 | 18 | target 'JJSwiftLogTests' do 19 | inherit! :search_paths 20 | # Pods for testing 21 | end 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODFILE CHECKSUM: 86a7db6cfdc5b079dcb47ff94346401c1a090ef7 2 | 3 | COCOAPODS: 1.8.4 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Swift4.0+](https://img.shields.io/badge/Swift-4.0%2B-blue.svg?style=flat) 2 | [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/JJSwiftLog.svg)](https://img.shields.io/cocoapods/v/JJSwiftLog.svg) 3 | [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | [![Platform](https://img.shields.io/cocoapods/p/JJSwiftLog.svg?style=flat)](http://cocoadocs.org/docsets/JJSwiftLog) 5 | ![License MIT](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000) 6 | 7 | # JJSwiftLog 8 | 9 | ![JJSwiftLog screenshot](https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/master/screenshots/main.png) 10 | 11 | Keep the Swift log concise, and also take into account the basic functions of the log, file name, function name, number of lines and other information, built-in console and file log functions, to meet the basic needs of developers, custom logs for developers to be highly flexible. 12 | 13 | ## Feature 14 | 15 | - [x] Console display (Console Log), taking into account the features of `NSLog` 16 | 17 | - [x] Log file storage (File Log), advanced properties of configuration file log 18 | 19 | - [x] User-defined log, inherits `JJLogObject` 20 | 21 | - [x] Global switch log 22 | 23 | - [x] Show only the specified file log 24 | 25 | - [x] Custom log filter 26 | 27 | - [x] Custom log format, any combination, built-in styles for developers to choose, built-in ANSIColor format 28 | 29 | - [x] Supports multi-platform iOS, MacOS, Windows and Linux 30 | 31 | ## Install 32 | 33 | * Swift 4.0+ 34 | 35 | 36 | __Podfile__ 37 | 38 | 39 | ``` 40 | pod 'JJSwiftLog' 41 | ``` 42 | 43 | __Carthage__ 44 | 45 | ``` 46 | github "jezzmemo/JJSwiftLog" 47 | ``` 48 | 49 | __Swift Package Manager__ 50 | 51 | ``` 52 | .package(url: "https://github.com/jezzmemo/JJSwiftLog.git"), 53 | ``` 54 | 55 | ## How to use 56 | 57 | ### Quick to use 58 | 59 | * Import module 60 | 61 | ``` 62 | import JJSwiftLog 63 | ``` 64 | 65 | * Quick start 66 | 67 | It is generally recommended to initialize at the entry of the program. The console and file log are configured by default. You only need to configure the log level. example: 68 | 69 | ```swift 70 | override func viewDidLoad() { 71 | super.viewDidLoad() 72 | JJLogger.setup(level: .verbose) 73 | 74 | JJLogger.verbose("verbose") 75 | JJLogger.debug("debug") 76 | JJLogger.info("info") 77 | JJLogger.warning("warn") 78 | JJLogger.error("error") 79 | } 80 | ``` 81 | 82 | 83 | ### Advanced 84 | 85 | * The developer configures the log 86 | 87 | ```swift 88 | override func viewDidLoad() { 89 | super.viewDidLoad() 90 | // filePath needs to store the path 91 | var file = JJFileOutput(filePath: "filePath", delegate: JJLogger, identifier: "file") 92 | file?.targetMaxFileSize = 1000 * 1024 93 | file?.targetMaxTimeInterval = 600 94 | file?.targetMaxLogFiles = 20 95 | JJLogger.addLogOutput(file) 96 | #if DEBUG 97 | JJLogger.addLogOutput(JJConsoleOutput(identifier: "console")) 98 | #endif 99 | // Note the timing of the startLogInfo call 100 | JJLogger.startLogInfo() 101 | JJLogger.verbose("verbose") 102 | JJLogger.debug("debug") 103 | JJLogger.info("info") 104 | JJLogger.warning("warn") 105 | JJLogger.error("error") 106 | // Any type 107 | JJLogger.verbose(123) 108 | JJLogger.debug(1.2) 109 | JJLogger.info(Date()) 110 | JJLogger.warning(["1", "2"]) 111 | } 112 | ``` 113 | 114 | * `JJConsoleOutput` use the `NSLog` style, use the `isUseNSLog` property 115 | 116 | ```swift 117 | let console = JJConsoleOutput() 118 | console.isUseNSLog = false 119 | ``` 120 | 121 | * `JJFileOutput`There are several properties to adjust the storage file strategy 122 | 123 | * `targetMaxFileSize`Maximum file size 124 | 125 | * `targetMaxTimeInterval`Generate new file interval 126 | 127 | * `targetMaxFileSize`The maximum number of files, if this number is exceeded, the previous files will be deleted 128 | 129 | ```swift 130 | let file = JJFileOutput() 131 | file?.targetMaxFileSize = 1000 * 1024 132 | file?.targetMaxTimeInterval = 600 133 | file?.targetMaxLogFiles = 20 134 | ``` 135 | 136 | * Set `enable` to switch logging in real time, which is enabled by default 137 | 138 | ```swift 139 | JJLogger.enable = true 140 | ``` 141 | 142 | * Set the `onlyLogFile` method to make the specified file display logs 143 | 144 | ```swift 145 | JJLogger.onlyLogFile("ViewController") 146 | ``` 147 | 148 | * JJSwiftLog supports custom format logs. The following table is the correspondence between abbreviated letters: 149 | 150 | | Shorthand | Describtion | 151 | |------|--------| 152 | | %M | log text | 153 | | %L | log level | 154 | | %l | log line | 155 | | %F | filename, without suffix | 156 | | %f | Function name | 157 | | %D | Date (currently only yyyy-MM-dd HH:mm:ss.SSSZ is supported) | 158 | | %T | Thread, if the main thread displays main, the child thread displays the address or QueueLabel | 159 | | %t | Display HH:mm:ss format | 160 | | %d | Display yyyy-MM-dd format | 161 | | %N | filename, with suffix | 162 | 163 | Example: 164 | 165 | ```swift 166 | JJLogger.format = "%M %F %L%l %f %D" 167 | ``` 168 | 169 | There are also built-in styles, such as: `JJLogger.format = JJSwiftLog.simpleFormat`, example: 170 | 171 | ``` 172 | 2020-04-08 22:56:54.888+0800 -> ViewController:18 - setupVendor(parameter:) method set the parameter 173 | 2020-04-08 22:56:54.889+0800 -> ViewController:28 - viewDidLoad() Start the record 174 | 2020-04-08 22:56:54.889+0800 -> ViewController:29 - viewDidLoad() Debug the world 175 | 2020-04-08 22:56:54.890+0800 -> ViewController:30 - viewDidLoad() Show log info 176 | 2020-04-08 22:56:54.890+0800 -> ViewController:31 - viewDidLoad() Build warning 177 | 2020-04-08 22:56:54.890+0800 -> ViewController:32 - viewDidLoad() can’t fetch user info without user id 178 | ``` 179 | 180 | * Implement the custom interface `JJLogObject` as needed, the example: 181 | 182 | ```swift 183 | public class CustomerOutput: JJLogObject { 184 | ///重写output即可 185 | open override func output(log: JJLogEntity, message: String) { 186 | 187 | } 188 | 189 | } 190 | ``` 191 | 192 | * Each `JJLogObject` corresponds to a `formatters` (formatting) and `filters` (filtering) attributes. You can customize the formatting and filters according to your own needs. Example: 193 | 194 | ```swift 195 | open class CustomerFormatter: JJLogFormatterProtocol { 196 | public func format(log: JJLogEntity, message: String) -> String { 197 | return "" 198 | } 199 | } 200 | ``` 201 | 202 | ```swift 203 | open class CustomerFilter: JJLogFilter { 204 | func ignore(log: JJLogEntity, message: String) -> Bool { 205 | return false 206 | } 207 | } 208 | ``` 209 | 210 | * Built-in `JJFormatterLogANSIColor`, you can use the terminal to view the log with color, just add the following in `formatters`: 211 | 212 | **The xcode console does not support ANSIColor mode, currently only tested on the terminal** 213 | 214 | ```swift 215 | let file = JJFileOutput(delegate: JJLogger, identifier: "file") 216 | file?.targetMaxFileSize = 1000 * 1024 217 | file?.targetMaxTimeInterval = 600 218 | file?.targetMaxLogFiles = 20 219 | file?.formatters = [JJFormatterLogANSIColor()] 220 | JJLogger.addLogOutput(file!) 221 | ``` 222 | 223 | Example: 224 | 225 | ![JJSwiftLog ANSIColor](https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/master/screenshots/ansicolor.png) 226 | 227 | * Support __Sentry__, example: 228 | 229 | ```swift 230 | let sentry = JJSentryOutput(sentryKey: "key", 231 | sentryURL: URL(string: "http://www.exmaple.com/api/5/store/")!, delegate: JJLogger) 232 | sentry.completion = { result in 233 | } 234 | sentry.failure = { error in 235 | } 236 | JJLogger.addLogOutput(sentry) 237 | ``` 238 | 239 | 240 | ## Linker 241 | * [Guard iOS App](https://github.com/jezzmemo/JJException) 242 | * [中文说明](https://github.com/jezzmemo/JJSwiftLog/blob/master/README_CN.md) 243 | 244 | ## License 245 | JJSwiftLog is released under the MIT license. See LICENSE for details. 246 | 247 | 248 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | ![Swift4.0+](https://img.shields.io/badge/Swift-4.0%2B-blue.svg?style=flat) 2 | [![CocoaPods Compatible](https://img.shields.io/cocoapods/v/JJSwiftLog.svg)](https://img.shields.io/cocoapods/v/JJSwiftLog.svg) 3 | [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 4 | [![Platform](https://img.shields.io/cocoapods/p/JJSwiftLog.svg?style=flat)](http://cocoadocs.org/docsets/JJSwiftLog) 5 | ![License MIT](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000) 6 | 7 | # JJSwiftLog 8 | 9 | ![JJSwiftLog screenshot](https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/master/screenshots/main.png) 10 | 11 | 延续了Swift日志的简洁,也兼顾了日志的基本功能,文件名,函数名,行数等信息,内置了控制台和文件日志功能,满足开发者的基本需求,自定义日志予以开发者高度灵活的空间 12 | 13 | ## 主要功能 14 | 15 | - [x] 控制台展示(Console Log),兼顾`NSLog`的特性 16 | 17 | - [x] 日志文件存储(File Log),配置文件日志的高级属性 18 | 19 | - [x] 用户自定义日志,继承`JJLogObject` 20 | 21 | - [x] 全局开关日志 22 | 23 | - [x] 只显示指定文件日志 24 | 25 | - [x] 自定义过滤 26 | 27 | - [x] 自定义日志格式,任意组合, 内置样式供开发者选择,内置了ANSIColor格式 28 | 29 | - [x] 支持多平台iOS,MacOS,Windows和Linux 30 | 31 | ## 如何安装 32 | 33 | * Swift 4.0+ 34 | 35 | 36 | __Podfile__ 37 | 38 | 39 | ``` 40 | pod 'JJSwiftLog' 41 | ``` 42 | 43 | __Carthage__ 44 | 45 | ``` 46 | github "jezzmemo/JJSwiftLog" 47 | ``` 48 | 49 | __Swift Package Manager__ 50 | 51 | ``` 52 | .package(url: "https://github.com/jezzmemo/JJSwiftLog.git"), 53 | ``` 54 | 55 | ## 如何使用 56 | 57 | ### 快速使用 58 | 59 | * 导入模块 60 | 61 | ``` 62 | import JJSwiftLog 63 | ``` 64 | 65 | * 快速入门 66 | 67 | 一般推荐在程序的入口处,进行初始化,默认配置了控制台和文件日志,只需要配置日志级别即可,以下是示例: 68 | 69 | ```swift 70 | override func viewDidLoad() { 71 | super.viewDidLoad() 72 | JJLogger.setup(level: .verbose) 73 | 74 | JJLogger.verbose("verbose") 75 | JJLogger.debug("debug") 76 | JJLogger.info("info") 77 | JJLogger.warning("warn") 78 | JJLogger.error("error") 79 | } 80 | ``` 81 | 82 | 83 | ### 高级使用 84 | 85 | * 开发者自己配置日志 86 | 87 | ```swift 88 | override func viewDidLoad() { 89 | super.viewDidLoad() 90 | // filePath需要存储的路径 91 | var file = JJFileOutput(filePath: "filePath", delegate: JJLogger, identifier: "file") 92 | file?.targetMaxFileSize = 1000 * 1024 93 | file?.targetMaxTimeInterval = 600 94 | file?.targetMaxLogFiles = 20 95 | JJLogger.addLogOutput(file) 96 | #if DEBUG 97 | JJLogger.addLogOutput(JJConsoleOutput(identifier: "console")) 98 | #endif 99 | // 注意startLogInfo调用时机 100 | JJLogger.startLogInfo() 101 | JJLogger.verbose("verbose") 102 | JJLogger.debug("debug") 103 | JJLogger.info("info") 104 | JJLogger.warning("warn") 105 | JJLogger.error("error") 106 | // 任意类型 107 | JJLogger.verbose(123) 108 | JJLogger.debug(1.2) 109 | JJLogger.info(Date()) 110 | JJLogger.warning(["1", "2"]) 111 | } 112 | ``` 113 | 114 | * `JJConsoleOutput`可以使用 `NSLog`样式,使用`isUseNSLog`属性即可 115 | 116 | ```swift 117 | let console = JJConsoleOutput() 118 | console.isUseNSLog = false 119 | ``` 120 | 121 | * `JJFileOutput`有几个属性可以调整存储文件策略 122 | 123 | * `targetMaxFileSize`文件最大体积 124 | 125 | * `targetMaxTimeInterval`生成新文件间隔 126 | 127 | * `targetMaxFileSize`文件最大个数,如果超出这个数,就会删除之前的文件 128 | 129 | ```swift 130 | let file = JJFileOutput() 131 | file?.targetMaxFileSize = 1000 * 1024 132 | file?.targetMaxTimeInterval = 600 133 | file?.targetMaxLogFiles = 20 134 | ``` 135 | 136 | * 使用`enable`,实时开关日志,默认是开启的 137 | 138 | ```swift 139 | JJLogger.enable = true 140 | ``` 141 | 142 | * 使用`onlyLogFile`方法,让指定文件显示日志 143 | 144 | ```swift 145 | JJLogger.onlyLogFile("ViewController") 146 | ``` 147 | 148 | * JJSwiftLog支持自定义格式日志,以下表格是简写字母对应关系: 149 | 150 | | 简写 | 描述 | 151 | |------|--------| 152 | | %M | 日志文本 | 153 | | %L | 日志级别 | 154 | | %l | 行数 | 155 | | %F | 文件名,不带后缀 | 156 | | %f | 函数名 | 157 | | %D | 日期(目前仅支持yyyy-MM-dd HH:mm:ss.SSSZ) | 158 | | %T | 线程,如果主线程显示main,子线程显示地址或者QueueLabel | 159 | | %t | 显示HH:mm:ss格式 | 160 | | %d | 显示yyyy-MM-dd格式 | 161 | | %N | 文件名,带后缀 | 162 | 163 | 代码示例: 164 | 165 | ```swift 166 | JJLogger.format = "%M %F %L%l %f %D" 167 | ``` 168 | 169 | 还内置了一些样式,如:`JJLogger.format = JJSwiftLog.simpleFormat`,样式如下: 170 | 171 | ``` 172 | 2020-04-08 22:56:54.888+0800 -> ViewController:18 - setupVendor(parameter:) method set the parameter 173 | 2020-04-08 22:56:54.889+0800 -> ViewController:28 - viewDidLoad() Start the record 174 | 2020-04-08 22:56:54.889+0800 -> ViewController:29 - viewDidLoad() Debug the world 175 | 2020-04-08 22:56:54.890+0800 -> ViewController:30 - viewDidLoad() Show log info 176 | 2020-04-08 22:56:54.890+0800 -> ViewController:31 - viewDidLoad() Build warning 177 | 2020-04-08 22:56:54.890+0800 -> ViewController:32 - viewDidLoad() can’t fetch user info without user id 178 | ``` 179 | 180 | * 根据需要实现自定义接口`JJLogObject`,示例如下: 181 | 182 | ```swift 183 | public class CustomerOutput: JJLogObject { 184 | ///重写output即可 185 | open override func output(log: JJLogEntity, message: String) { 186 | 187 | } 188 | 189 | } 190 | ``` 191 | 192 | * 每个`JJLogObject`对应有一个`formatters`(格式化)和`filters`(过滤)的属性,根据自己的需求可以定制格式化和过滤器,示例如下: 193 | 194 | ```swift 195 | open class CustomerFormatter: JJLogFormatterProtocol { 196 | public func format(log: JJLogEntity, message: String) -> String { 197 | return "" 198 | } 199 | } 200 | ``` 201 | 202 | ```swift 203 | open class CustomerFilter: JJLogFilter { 204 | func ignore(log: JJLogEntity, message: String) -> Bool { 205 | return false 206 | } 207 | } 208 | ``` 209 | 210 | * 内置了`JJFormatterLogANSIColor`,可以用终端查看用颜色的日志,只需要在`formatters`加入如下: 211 | 212 | **控制台不支持ANSIColor模式,目前只在终端上测试通过** 213 | 214 | ```swift 215 | let file = JJFileOutput(delegate: JJLogger, identifier: "file") 216 | file?.targetMaxFileSize = 1000 * 1024 217 | file?.targetMaxTimeInterval = 600 218 | file?.targetMaxLogFiles = 20 219 | file?.formatters = [JJFormatterLogANSIColor()] 220 | JJLogger.addLogOutput(file!) 221 | ``` 222 | 223 | 显示的样式如下: 224 | 225 | ![JJSwiftLog ANSIColor](https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/master/screenshots/ansicolor.png) 226 | 227 | * 支持Sentry网络日志, 使用示例如下: 228 | 229 | ```swift 230 | let sentry = JJSentryOutput(sentryKey: "key", 231 | sentryURL: URL(string: "http://www.exmaple.com/api/5/store/")!, delegate: JJLogger) 232 | sentry.completion = { result in 233 | } 234 | sentry.failure = { error in 235 | } 236 | JJLogger.addLogOutput(sentry) 237 | ``` 238 | 239 | 240 | ## FAQ 241 | 242 | * [0.0.x如何升级到0.1.x](https://github.com/jezzmemo/JJSwiftLog/wiki/JJSwiftLog%E5%A6%82%E4%BD%95%E5%8D%87%E7%BA%A7%E5%88%B00.1.0) 243 | 244 | ## TODO(记得给我星哦) 245 | 246 | * 优化文件存储 247 | 248 | ## Linker 249 | * [保护App不闪退](https://github.com/jezzmemo/JJException) 250 | 251 | ## License 252 | JJSwiftLog is released under the MIT license. See LICENSE for details. 253 | 254 | 255 | -------------------------------------------------------------------------------- /screenshots/ansicolor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/bf2803f81a16f86f84c7993f97f87d737856837f/screenshots/ansicolor.png -------------------------------------------------------------------------------- /screenshots/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/bf2803f81a16f86f84c7993f97f87d737856837f/screenshots/architecture.png -------------------------------------------------------------------------------- /screenshots/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/bf2803f81a16f86f84c7993f97f87d737856837f/screenshots/main.png -------------------------------------------------------------------------------- /screenshots/pay.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jezzmemo/JJSwiftLog/bf2803f81a16f86f84c7993f97f87d737856837f/screenshots/pay.jpeg -------------------------------------------------------------------------------- /updateCocoaPod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | increment_version() { 4 | local usage=" USAGE: $FUNCNAME [-l] [-t] [] [] 5 | -l : remove leading zeros 6 | -t : drop trailing zeros 7 | : The version string. 8 | : Optional. The position (starting with one) of the number 9 | within to increment. If the position does not 10 | exist, it will be created. Defaults to last position. 11 | : The leftmost position that can be incremented. If does not 12 | exist, position will be created. This right-padding will 13 | occur even to right of , unless passed the -t flag." 14 | 15 | # Get flags. 16 | local flag_remove_leading_zeros=0 17 | local flag_drop_trailing_zeros=0 18 | while [ "${1:0:1}" == "-" ]; do 19 | if [ "$1" == "--" ]; then shift; break 20 | elif [ "$1" == "-l" ]; then flag_remove_leading_zeros=1 21 | elif [ "$1" == "-t" ]; then flag_drop_trailing_zeros=1 22 | else echo -e "Invalid flag: ${1}\n$usage"; return 1; fi 23 | shift; done 24 | 25 | # Get arguments. 26 | if [ ${#@} -lt 1 ]; then echo "$usage"; return 1; fi 27 | local v="${1}" # version string 28 | local targetPos=${2-last} # target position 29 | local minPos=${3-${2-0}} # minimum position 30 | 31 | # Split version string into array using its periods. 32 | local IFSbak; IFSbak=IFS; IFS='.' # IFS restored at end of func to 33 | read -ra v <<< "$v" # avoid breaking other scripts. 34 | 35 | # Determine target position. 36 | if [ "${targetPos}" == "last" ]; then 37 | if [ "${minPos}" == "last" ]; then minPos=0; fi 38 | targetPos=$((${#v[@]}>${minPos}?${#v[@]}:$minPos)); fi 39 | if [[ ! ${targetPos} -gt 0 ]]; then 40 | echo -e "Invalid position: '$targetPos'\n$usage"; return 1; fi 41 | (( targetPos-- )) || true # offset to match array index 42 | 43 | # Make sure minPosition exists. 44 | while [ ${#v[@]} -lt ${minPos} ]; do v+=("0"); done; 45 | 46 | # Increment target position. 47 | v[$targetPos]=`printf %0${#v[$targetPos]}d $((10#${v[$targetPos]}+1))`; 48 | 49 | # Remove leading zeros, if -l flag passed. 50 | if [ $flag_remove_leading_zeros == 1 ]; then 51 | for (( pos=0; $pos<${#v[@]}; pos++ )); do 52 | v[$pos]=$((${v[$pos]}*1)); done; fi 53 | 54 | # If targetPosition was not at end of array, reset following positions to 55 | # zero (or remove them if -t flag was passed). 56 | if [[ ${flag_drop_trailing_zeros} -eq "1" ]]; then 57 | for (( p=$((${#v[@]}-1)); $p>$targetPos; p-- )); do unset v[$p]; done 58 | else for (( p=$((${#v[@]}-1)); $p>$targetPos; p-- )); do v[$p]=0; done; fi 59 | 60 | echo "${v[*]}" 61 | IFS=IFSbak 62 | return 0 63 | } 64 | 65 | #Generate new version 66 | 67 | currentVersionString=`grep -E 's.version.*=' JJSwiftLog.podspec` 68 | 69 | VersionNumber=`tr -d [a-z][=\"] <<<"$currentVersionString"` 70 | 71 | currentVersion=`echo ${VersionNumber:3}` 72 | 73 | newVersion=`increment_version ${currentVersion} 3` 74 | 75 | lineNumber=`grep -nE 's.version.*=' JJSwiftLog.podspec | cut -d : -f1` 76 | 77 | sed -i "" "${lineNumber}s/${currentVersion}/${newVersion}/g" JJSwiftLog.podspec 78 | 79 | echo "Current version: ${currentVersion}, New version: ${newVersion}" 80 | 81 | #Push JJException.podspec 82 | 83 | git add JJSwiftLog.podspec 84 | git commit -a -m ${newVersion} 85 | 86 | git tag ${newVersion} 87 | git push origin master --tags 88 | pod trunk push ./JJSwiftLog.podspec --verbose --allow-warnings 89 | 90 | 91 | --------------------------------------------------------------------------------