log.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Generated by IcedCoffeeScript 1.7.1-c
  2. (function() {
  3. var Logger, baselog, k, rpc, v,
  4. __hasProp = {}.hasOwnProperty,
  5. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
  6. baselog = require('iced-logger');
  7. rpc = require('framed-msgpack-rpc').log;
  8. Logger = (function(_super) {
  9. __extends(Logger, _super);
  10. function Logger() {
  11. return Logger.__super__.constructor.apply(this, arguments);
  12. }
  13. Logger.prototype._log = function(m, l, ohook) {
  14. var map, msg, parts;
  15. parts = [];
  16. if (this.prefix != null) {
  17. parts.push(this.prefix);
  18. }
  19. parts.push(m);
  20. msg = parts.join(" ");
  21. map = {
  22. D: "debug",
  23. I: "info",
  24. W: "warn",
  25. E: "error",
  26. F: "fatal"
  27. };
  28. l = map[l] || "warn";
  29. return baselog[l](msg);
  30. };
  31. Logger.prototype.make_child = function(d) {
  32. return new Logger(d);
  33. };
  34. return Logger;
  35. })(rpc.Logger);
  36. rpc.set_default_logger_class(Logger);
  37. for (k in baselog) {
  38. v = baselog[k];
  39. exports[k] = v;
  40. }
  41. }).call(this);