Giter VIP home page Giter VIP logo

jlconsolelog's Introduction

JLConsoleLog

What is JLConsoleLog?

JLConsoleLog is an awesome tool In-App to help swift developer log information in both development and production environment. You won't miss any key and useful logs about the bugs in non-debug mode. You also can integrate it in your project's backdoor toolkit, it will help you solve vital issues.

How to operate it?

JLConsoleLog supports three types of style (display mode) -- Floating, Bubble and FullScreen

Floating

Bubble

FullScreen

There are four buttons on the option view of floating mode. The first button is setting button where you can clear all logs from this console, filter categories and levels. The second one is for switching between floating and fullscreen mode. If the third one is pressed, the console will be a translucent bubble that only displays warning and error count. The last one is close button.

The floating console could become translucent automatically after 5s, if you don't touch it. Additionally, you can drag floating console and bubble to anywhere to avoid disturb you.

While you tap a log cell, you can enter the detail page of log.


Performance monitor is a new function. You can invoke a monitor chart from bubble button now.

How to use it in your project?

The JLConsoleController is the console's controller opened for developers. It contains a shared instance. You could set style and logEnabled via it. While you set its style (display mode), the console will immediately show in terms of you given. Like this:

if JLConsoleController.shared.style == .Hidden {
     JLConsoleController.shared.style = .Floating //show console in floating fashion
        } else {
    JLConsoleController.shared.style = .Hidden //hide console
        }

If logEnabled is true, the console will collect log data, vice verse.

JLConsoleController.shared.logEnabled = true

A series functions are offered to log.

func JLLevelLog(level: JLConsoleLogLevel, category: JLConsoleLogCategory, hasFollowingAction:Bool = false, needPrint:Bool = false, contextData:Dictionary<String,Any> , formats: String...)

func JLVerboseLog( category: JLConsoleLogCategory, hasFollowingAction:Bool = false, needPrint:Bool = false, contextData:Dictionary<String,Any> , formats: String...) 

func JLDebugLog( category: JLConsoleLogCategory, hasFollowingAction:Bool = false, needPrint:Bool = false, contextData:Dictionary<String,Any> , formats: String...)

func JLInfoLog( category: JLConsoleLogCategory, hasFollowingAction:Bool = false, needPrint:Bool = false, contextData:Dictionary<String,Any> , formats: String...)

func JLWarningLog( category: JLConsoleLogCategory, hasFollowingAction:Bool = false, needPrint:Bool = false, contextData:Dictionary<String,Any> , formats: String...)

func JLErrorLog( category: JLConsoleLogCategory, hasFollowingAction:Bool = false, needPrint:Bool = false, contextData:Dictionary<String,Any> , formats: String...)

The JLConsoleLogLevel is an enum to sort by different levels. The numbers of warning and error are displayed on option view and bubble.

The JLConsoleLogCategory is your business category and is an alias of String. You can define your own categories met your demand, such as Video, TrackPage, Commodity Detail... If you need to filter your categories, you must register in this way in your code:

let SubPageTestLog:JLConsoleLogCategory = "com.consolelog.mybusiness" //declare a category

JLConsoleController.shared.register(newCategory: SubPageTestLog) //register it

The parameter, contextData, is a serializable Dictionary. The data will be shown on the detail page in Json.

The parameters, formats, is variadic parameters of String. The first value will be shown on the cell's title in console.

If needPrint equals true, the log information will print in your Xcode console in Debug environment.

Otherwise, JLConsoleController provides a followingAction to operate other actions when you finish logging. For example, you can send a track point log to statistics server such as Firebase in followingAction closure. Meanwhile, please don't forget to set hasFollowingAction as true while you log.

JLErrorLog(category: SubPageTestLog, hasFollowingAction: true ,needPrint: true, contextData: ["test":5], formats: "Error!",#function,String(#line))

This is an error log example.


Performance Monitor

JLConsoleLog provides a performance monitor. You can add these to turn on it.

JLConsoleController.shared.performanceMonitable = true

The git address is https://github.com/jacklandrin/JLConsoleLog

Requirement

  • iOS 12
  • Swift 5.2
  • Xcode 11

Reference

PerformanceMonitor

License

MIT

jlconsolelog's People

Contributors

jacklandrin 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.