All Projects → RyanLeeLY → Coolog

RyanLeeLY / Coolog

Licence: mit
A expandable and flexible log framework for iOS. iOS一个灵活、可扩展的日志组件。

Projects that are alternatives of or similar to Coolog

Laravel Log
Simple API to write logs for Laravel.
Stars: ✭ 19 (-76.83%)
Mutual labels:  log, logger
Logcustom
A simple log customization tool based on golang 一个基于golang简单的日志定制化工具
Stars: ✭ 46 (-43.9%)
Mutual labels:  log, logger
Gollum
An n:m message multiplexer written in Go
Stars: ✭ 883 (+976.83%)
Mutual labels:  log, logger
Yii2 Psr Log Target
Yii 2.0 log target that is able to write messages to PSR-3 compatible logger
Stars: ✭ 58 (-29.27%)
Mutual labels:  log, logger
Signale
Highly configurable logging utility
Stars: ✭ 8,575 (+10357.32%)
Mutual labels:  log, logger
Eylogviewer
A simple viewer to see your app's logs on your iDevice in realtime.
Stars: ✭ 16 (-80.49%)
Mutual labels:  log, logger
Activity
A PHP API to log anything anywhere
Stars: ✭ 44 (-46.34%)
Mutual labels:  log, logger
gxlog
A concise, functional, flexible and extensible logger for go.
Stars: ✭ 65 (-20.73%)
Mutual labels:  log, logger
Loguru
Python logging made (stupidly) simple
Stars: ✭ 10,510 (+12717.07%)
Mutual labels:  log, logger
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-37.8%)
Mutual labels:  log, logger
Objectlogger
A powerful and easy-to-use operational logging system that supports analysis of changes in object properties. 强大且易用的操作日志记录系统,支持对象属性的变化分析。
Stars: ✭ 378 (+360.98%)
Mutual labels:  log, logger
Android Filelogger
A general-purpose logging library with built-in support to save logs to file efficiently.
Stars: ✭ 70 (-14.63%)
Mutual labels:  log, logger
Cocoadebug
iOS Debugging Tool 🚀
Stars: ✭ 3,769 (+4496.34%)
Mutual labels:  log, logger
Logger
Simple logger with stores inspector
Stars: ✭ 58 (-29.27%)
Mutual labels:  log, logger
esp-logger
An Arduino library providing a minimal interface to log data on flash memory and SD cards with ESP8266 and ESP32
Stars: ✭ 40 (-51.22%)
Mutual labels:  log, logger
Loglevelnext
A modern logging library for Node.js that provides log level mapping to the console
Stars: ✭ 33 (-59.76%)
Mutual labels:  log, logger
printer
A fancy logger yet lightweight, and configurable. 🖨
Stars: ✭ 65 (-20.73%)
Mutual labels:  log, logger
horse-logger
Middleware for access logging in HORSE
Stars: ✭ 25 (-69.51%)
Mutual labels:  log, logger
Logutils
More convenient and easy to use android Log manager
Stars: ✭ 1,035 (+1162.2%)
Mutual labels:  log, logger
Plog
Portable, simple and extensible C++ logging library
Stars: ✭ 1,061 (+1193.9%)
Mutual labels:  log, logger

Coolog

Coolog is a expandable and flexible log framework for iOS. It provides a browser logging tool that can replace xcode console.

CI Status Version License Platform

Features

  • Simple Coolog has a simple usage. We make it as simple as possible to setup Coolog. Also, we provides some simplified methods of basic function.

  • Flexible Coolog provides multiple log methods (Console, NSLog and File) and log-level.

  • Expandable You can even customize your own logger and formatter, which are components of log-driver. Then your customized log-driver can also be added to log-engine. Do whatever you want in your customized logger.

  • Web Browser Tool Coolog provides a web browser tool, which makes it easy to debug.

BrowserTool

Installation

cocoapods

pod 'Coolog'

Architecture

Architecture

Usage

Setup

[[COLLogManager sharedInstance] setup];
    
[[COLLogManager sharedInstance] enableFileLog];  // open file log
[[COLLogManager sharedInstance] enableConsoleLog];  // open xcode console log
//    [[COLLogManager sharedInstance] enableNSLog];
    
#ifdef DEBUG
    [COLLogManager sharedInstance].level = COLLogLevelAll;
#else
    [COLLogManager sharedInstance].level = COLLogLevelInfo;
#endif

Log

CLogError(@"tag", @"%@", @"log content");
	
CLogWarning(@"tag", @"%@", @"log content");
	
CLogInfo(@"tag", @"%@", @"log content");
	
CLogDefault(@"tag", @"%@", @"log content");
	
CLogDebug(@"tag", @"%@", @"log content");

Web Browser Tool

[[COLLogManager sharedInstance] enableRemoteConsole];

Make sure your pc and your phone under the same wifi. Open your web browser and visit [http://coolog.oss-cn-hangzhou.aliyuncs.com/index.html?host=ws://YourPhoneIPAddr:9001/coolog]

Advanced

The section below will introduce how to customize your own logger. You can follow 3 steps below.

  • Step 1: Implement your own logger.
#import "COLLogger.h"
@interface MyLogger : NSObject <COLLogger>

@end
#import "MyLogger.h"
#import <os/log.h>

@implementation MyLogger
@synthesize formatterClass = _formatterClass;

+ (instancetype)logger {
    return [[MyLogger alloc] init];
}

// This is your own log method. It will be called by log engine. 
- (void)log:(NSString *)logString {
	//For example, here below uses os_log as its implementation.
    os_log(OS_LOG_DEFAULT, "%{public}s", [logString UTF8String]);
}
@end
  • Step 2: Implement your own formatter.
#import "COLLogFormatter.h"

@interface MyLogFormatter : NSObject <COLFormatable>

@end
#import "MyLogFormatter.h"

@implementation MyLogFormatter
// The log's format depends on this method.
- (NSString *)completeLogWithType:(COLLogType)type tag:(NSString *)tag message:(NSString *)message date:(NSDate *)date {
    return [NSString stringWithFormat:@"tag=[%@], type=[%zd], message=[%@], date=[%@]", tag, type, message, date];
}
@end
  • Step 3: Add your logger to log engine.
COLLoggerDriver *myDriver = [[COLLoggerDriver alloc] initWithLogger:[MyLogger logger]
                                                              formatter:[[MyLogFormatter alloc] init]
                                                                  level:COLLogLevelInfo];
[[COLLogManager sharedInstance].logEngine addDriver:myDriver];

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

TODO

  • Web browser Tool UI
  • Performance
  • Unit test
  • Swift version

Author

yao.li, [email protected]

Thanks

Coolog start a WebSocket server on your phone to send log data to your browser. We built this server using PocketSocket. Special thanks to PocketSocket and its contributors.

License

Coolog is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].