Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tilmangriesel/peregrinelogger
Robust AS3 Logging Framework
https://github.com/tilmangriesel/peregrinelogger
Last synced: 5 days ago
JSON representation
Robust AS3 Logging Framework
- Host: GitHub
- URL: https://github.com/tilmangriesel/peregrinelogger
- Owner: TilmanGriesel
- Created: 2013-02-26T14:29:31.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-09-13T09:18:41.000Z (over 11 years ago)
- Last Synced: 2023-03-14T17:00:43.122Z (almost 2 years ago)
- Language: JavaScript
- Size: 180 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PeregrineLogger
===============Simple, Small and Robust AS3 Logging Framework
## Features
* SWC Filesize 7KB
* Lightweight & Fast
* Extendible
* Memory Efficent
* Filter Functions
* Different Log Levels
* Memory logging
* Log Statistics## Sample output
Memory logging disabled:[0ms] [debug] [PeregrineLoggerExample] Hello Debug
Memory logging enabled:
[26.48mb] [0ms] [debug] [PeregrineLoggerExample] Hello Debug
## Usage
private static const logger:IPeregrineLogger = PeregrineLoggerFactory.getLogger(PeregrineLoggerExample);
public function PeregrineLoggerExample()
{
// setup log target
var traceTarget:PeregrineTraceTarget = new PeregrineTraceTarget();
traceTarget.logMemory = true;
PeregrineLoggerFactory.addTarget(traceTarget);
// setup log level
PeregrineLoggerFactory.logLevel(PeregrineLogLevel.ALL);
// log some messages
logger.debug('Hello', 'Debug');
logger.info('Hello', 'Info');
logger.warn('Hello', 'Warn');
logger.error('Hello', 'Error');
logger.fatal('Hello', 'Fatal');
}## Filter Functions
PeregrineLogger supports class name based filtering.
That means, that log messages can be filtered by full qualified class names (FQCN) or Classes itself.To enable the filter, simply type ```PeregrineLoggerFactory.filterClasses(MyClass, AnotherClass);```
or ```PeregrineLoggerFactory.filterClasses('com.pack.example::MyClass');```
Combinations possible.Another function of the filter system is, that you are able to invert the filter.
To exclude all classes defined in filterClasses() from logging,
type ```PeregrineLoggerFactory.invertClassFilter = true```## How to extend
Create a Class with an ```IPeregrineLogTarget``` implementation.Add the API:
* ```public function log(item:PeregrineLogItem, tp:Number):void```
* ```public function get logMemory():Boolean```
* ```public function set logMemory(value:Boolean):void```Add your Class as a log target with the ```PeregrineLoggerFactory.addTarget``` method.
Now you are able to access all incoming log data trough the ```PeregrineLogItem```.
The API provides you an timestamp as number, the log level as uint, the full qualified class name as string and finally the log message as string.
Another value is the ```tp``` number. The tp value defines the time past (since the first log entry was made).## Limitations
* Define your own log format