- // Load up dependencies
- if (typeof require === 'function') {
- var Ne = require('neon');
- Module = Ne.Module;
- } else {
- Module = global.Module;
- }
-
- var Cobalt = {};
- Module(Cobalt, 'Formatter')({});
-
- Cobalt.Formatter.Token = Module(Cobalt.Formatter, 'Token')({
- formatString : "{{message}}",
- replaceRule : /{{(.*?)}}/g,
- separatorLength : 60,
- separatorType : "-",
- format : function (logObject, opts){
- var indent, indentSize,
- separatorLength, separatorType,
- output;
- indentSize = logObject._indentLevel || 0;
-
- indent = Array(indentSize + 1).join(' ');
-
- if (logObject._separator) {
- separatorLength = logObject._separatorLength || this.separatorLength;
- separatorType = logObject._separatorType || this.separatorType;
- output = indent + Array(separatorLength - indentSize + 1).join(separatorType);
- } else {
- output = indent + this.parseFormatString(logObject, opts.formatString);
+ // Extend opts
+ if (opts) {
+ for (property in opts) {
+ if (opts.hasOwnProperty(property)) {
+ this[property] = opts[property];
+ }