Sha256: 3d5186633b787daeb846505f4ec21af245192b2f17193c26f0f306ca7cf72133
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
var id = 0; buster.testCase("Check pattern layout", { setUp: function() { JLog.errorHandler = function(error) { throw error }; }, tearDown: function() { }, "Basic layout": function() { var pl = new JLog.PatternLayout("%m%n"); var res = pl.format(new JLog.LoggingEvent(null, new Date(), JLog.Level.INFO, ["hello"], null)); assert.equals("hello\n", res, "just message with new line"); }, "Custom fields": function() { var pl = new JLog.PatternLayout("%f{left} %m %f{right}"); pl.setCustomField("left", "<<"); pl.setCustomField("right", ">>"); var res = pl.format(new JLog.LoggingEvent(null, new Date(), JLog.Level.INFO, ["whats up?"], null)); assert.equals("<< whats up? >>", res, "message with custom fields"); }, "Logger name and Level": function() { var pl = new JLog.PatternLayout("%c [%p] %m"); var res = pl.format(new JLog.LoggingEvent(JLog.getLogger("hi-log"), new Date(), JLog.Level.INFO, ["msg-msg"], null)); assert.equals("hi-log [INFO] msg-msg", res, "Logger name and Level has to be printed"); }, "Startup time": function() { var pl = new JLog.PatternLayout("%r"); var res = pl.format(new JLog.LoggingEvent(null, new Date(), JLog.Level.INFO, ["msg-msg"], null)); assert(/\d+/.test(res), "Startup time has to be printed"); } });
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jlog-rails-0.2.3 | test/pattern-layout-test.js |
jlog-rails-0.2.2 | test/pattern-layout-test.js |
jlog-rails-0.2.1 | test/pattern-layout-test.js |
jlog-rails-0.2.0 | test/pattern-layout-test.js |