Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tcorral/hermes.js
Message and Error logger implementation
https://github.com/tcorral/hermes.js
Last synced: 5 days ago
JSON representation
Message and Error logger implementation
- Host: GitHub
- URL: https://github.com/tcorral/hermes.js
- Owner: tcorral
- License: mit
- Created: 2011-10-08T12:55:19.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-07-22T08:35:28.000Z (over 11 years ago)
- Last Synced: 2024-11-04T04:32:21.126Z (17 days ago)
- Language: JavaScript
- Homepage: http://tcorral.github.com/Hermes.js
- Size: 346 KB
- Stars: 30
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.txt
- License: LICENSE
Awesome Lists containing this project
README
# Hermes.js
Hermes.js. Highly extensible message/error handler system.[Changelog](http://tcorral.github.com/Hermes.js/changelog.txt)
## Description
Hermes definition in Wikipedia:
"Hermes is the great messenger of the gods in Greek mythology and a guide to the Underworld"
Hermes will log all the messages for you.
Defer or send your logs immediately.
Different defined message types:* ALL
* DEBUG
* INFO
* TRACE
* WARNING
* ERROR
* FATAL
* DISRUPTORAnd if you have some error you can add (or add it by the system if it's an uncaugh error) info about the file (filename or filename Url) and the line number where the error is logged.
Another important things:
* You can create your own errors or messages
* You can create your own layouts
* You can create your own appenders
* You can create your own levelsHermes is an error handler that allows you to create your own log appenders extending the Appender abstract class and define your log and clear methods.
[Examples](http://tcorral.github.com/Hermes.js/examples_and_documents/index.html) to see for yourself!
## Usage
### Before using it:
Insert in your code:
### Add Message:
If Immediate mode is active the message will be logged immediately.Hermes.logger.addMessage( new Hermes.message( Hermes.level.DEBUG, "Category", "Message", "", "" ) );
### Log Error:
Hermes will try to log all the deferred and pending errors.Hermes.logger.log();
### Force Log:
Hermes will log all the deferred and pending error.Hermes.logger.forceLog();
### Create a new Message/Error
var NewError = function(sFilenameUrl, nLineNumber)
{
Hermes.message.apply(this, [Level.INFO, 'New Error or message', 'The error or message', sFilenameUrl, nLineNumber, sDateFormat]);
};
NewError.prototype = new Hermes.message();### Create a new Layout
var NewLayout = function()
{
Hermes.layout.apply(this, arguments);
};
NewLayout.prototype = new Hermes.layout();
NewLayout.prototype.format = function(oMessage)
{
//Your implementation must be here
};### Create a new Appender
var NewAppender = function(oLevel, sCategory, sMessage, sFilenameUrl, nLineNumber, sDateFormat)
{
Hermes.appender.apply(this, arguments);
this.oLayout = new NewLayout();
};
NewAppender.prototype = new Hermes.appender();
NewAppender.prototype.log = function(oError)
{
//Your implementation must be here
};
NewAppender.prototype.clear = function(oError)
{
//Your implementation must be here
};## Documentation
[Examples from cloned repo](examples_and_documents/index.html) to see for yourself!
[Examples](/tcorral/Hermes.js/tree/master/examples_and_documents/index.html) to see for yourself!
## License
Hermes.js is licensed under the MIT license.
## Agreements
Hermes.js was inspired by Log4Js.