Liquid Logging Utility

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
457
First Language
English
Primarily Uses
RMMV
Liquid Logging - Version 1.0
Liquidize

Introduction
Coming from a C#/Unity and C++ background, I felt the need to personally have a way to have better formatted log information in the console when debugging my scripts and events.

This may not serve much for a lot of you, but I figured I'd release it for those that it would serve well too. So I give you, Liquid_Logging. An extensible logging system for scripters and eventers to use

when debugging, or just to log information nicely! This is a logging system built similarly too logging systems like Log4Net, in that it is able to have different types of custom formatters and appenders created.

Ever wanted to be able to log stuff too files, or to a server? Well if the appender exists for this (it doesn't yet, maybe when I get the time <3) you can do just that. Basically this is a plugin that allows things to be logged to the console (and again, if you wanted too go a head and make the appender, custom things like files). 

Features

- The ability to log formatted messages and objects to any built in appender (Developer Console for example).

- The ability to specify the format used as a pattern string.

- The ability to log messages from events using a plugin command.

- The ability to create custom appenders and formatters to suit your needs.


Screenshots
Console Appender Output Example: http://puu.sh/l7Se3.png

Event Page Plugin Command Example: http://puu.sh/l7SeG.png (generates the above screenshot)

How to Use
For better instructions, see the help menu for the script in the plugin manager.

Using In Your Own Scripts (One way)

 // Script setup stuff above this code... (didn't want too include it)   // Variable to see if logging is available.  var logging = false; var mySuperDuperLogger = null;  if (Imported.Liquid_Logging) {    mySuperDuperLogger = Liquid.Logging.getLogger("MySuperDuperLog");    var mySuperDuperAppender = new Liquid_ConsoleAppender();    var mySuperDuperFormat = new Liquid_PatternFormat("[%d{HH:mm:ss}] [%c] [%l]: %m");     mySuperDuperLogger.setLevel(Liquid_LogLevel.All);    mySuperDuperAppender.setFormat(mySuperDuperFormat);    mySuperDuperLogger.addAppender(mySuperDuperAppender);    logging = true;  }  else  {      logging = false;  } // The Liquid_Logging plugin exists we can log stuff!  if (logging) {   mySuperDuperLogger.info("An Info message");   mySuperDuperLogger.debug("A Debug message");  mySuperDuperLogger.warn("A Warning message"); mySuperDuperLogger.error("An error message with an exception!",someExceptionGoesHere); } 
Using In events

To use in event simply call the Plugin Command as follows:

LiquidLog loglevelhere message goes here

Examples:

LiquidLog info Info Message HURRAY!

LiquidLog debug DEBUG MESSAGE YES!

LiquidLog warn A WARNING

LiquidLog error AN ERROR!
Demo
Coming soon if you guys really want one.

Script

Save the script as Liquid_Logging.js in your plugins file. 

 Download: http://pastebin.com/GVZqZAfV

FAQ
Q: What are patterns?
A: Patterns are what the PatternFormatter type of formatter uses to generate the logging message format. They're basically strings of variables to determine what goes where. An example is: [%c] [%l]: %m

    That pattern would log messages as "[Logger Name] [Logging Level]: Your logged message goes here."

Q: How do we extend this as  afford mentioned?
A: Create a new object for whatever you want to make a custom thing for (Appender or Formatter), and base that object off Liquid_LogAppender (for appenders) or Liquid_LogFormat (for formats).

    You can take a look at the Liquid_ConsoleAppender and Liquid_PatternFormatter for examples of this.

Q: Any future plans to extend this?

A: Sure I have some ideas, but if you have suggestions feel free to post!

Credit and Terms of Use
- Liquidize

You are free to use and extend this as you will, credit isn't needed but is appreciated.

Author's Notes
I apologize if this is poorly written, I've only been using Javascript for a week, but think I've done pretty good since its similar to languages I am used too. I am working on refactoring the code and optimizing it, as well as reformatting the comments/commenting the methods. So please be paitent.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

buinguyenhoangtho wrote on fizzly's profile.
Hello @fizzly, i would like to use your asset/ resource for my project ( is maybe commercial ). May i have your permission? Thanks you !
Working on breaking the limits of RPGMaker! :cool:
I have 470+ hours on RMMV but have only made a demo game, is this normal? :kaoswt: (I lose motivation a lot plus I use a 32gb laptop, so..)
I like Iron Maiden.
Benku wrote on Magnus0808's profile.
Hey man you helped me out a long time ago with a plugin i was wondering if you can help me out one more time since its literally the last thing i need help with if not is cool but id figured id ask you one more soild.

Forum statistics

Threads
95,427
Messages
929,082
Members
125,659
Latest member
AphoticAmaranth
Top