GithubHelp home page GithubHelp logo

ddlogmanager's Introduction

DDLogManager Carthage compatible Build Status

DDLogManager 是一个高效、简单的日志管理框架。该项目仅使用 Swift 实现,提供方便的日志输出控制和管理功能。

特性

  • 支持 iOS/masOS/tvOS/watchOS、Ubuntu
  • 分等级的日志打印
  • 默认支持 控制台 文件 两种日志输出,也可遵循DDLoger协议,增加自定义的日志输出方式
  • 自定义打印样式 遵循 DDLogerFormatter 协议

要求

  • Swift 3.0 +

导入

Swift Package Manager

Packages.swift 文件中加入依赖

import PackageDescription

let package = Package(
    name: "YourProjectName",
    dependencies: [
        .Package(url: "https://github.com/HJianBo/DDLogManager", majorVersion: 0)
    ]
)

Carthage

Carthfile 加入依赖

github "HJianBo/DDLogManager" ~> 0.4

Carthage的使用参见其 README

使用

打印日志

在将 DDLogManager 加入到工程依赖,并编译成功后,参考如下代码,来打印日志

import DDLogManager

// Init
DDLogManager.addLoger(DDTTYLoger.sharedInstance) // TTY  = Xcode console
DDLogManager.addLoger(DDFileLoger.sharedInstance) // File = Written log to file

// ...

DDLogVerbose("This is verbose log message.")
DDLogDebug("This is debug log message.")
DDLogInfo("This is info log message.")
DDLogWarn("This is warning log message.")
DDLogError("This is error log message.")

设置日志等级

支持给不同的日志打印器,设置特定的日志等级,默认为 .debug

DDTTYLoger.sharedInstance.level = .debug

DDFileLoger.sharedInstance.level = .warning

TODO

  1. 支持终端不同日志等级的颜色打印
  2. 支持 Linux

感谢

参照大神@CocoaLumberjack完成编写.

Thanks! 😃

ddlogmanager's People

Contributors

hjianbo avatar

Watchers

James Cloos avatar Wesley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.