Skip to content

Conversation

@lewismoten
Copy link

Resolves #18 with the introduction of two new migration options.

--log-level <threshold> Allows the user to control the level of logging with one of the following: NONE, CRITICAL, ERROR, WARN, INFO, LOG, DEBUG, ALL. It's a lightweight implementation that should be familiar to developers that have worked with Log4<platform> libraries.

migration.init(
  connection,
  __dirname + '/migrations',
  function() {},
  [
    "--log-level ERROR"
  ]
);

--logger allows the developer to specify their own custom logger so long as it exposes methods for error, warn, info, log, debug that accept a string message.

var customLogger = {
  debug: function (message) {
    console.debug(message);
  },
  log: function (message) {
    console.log(message);
  },
  info: function (message) {
    console.info(message);
  },
  warn: function (message) {
    console.warn(message);
  },
  error: function (message) {
    console.error(message);
  },
  critical: function (message) {
    console.error(message);
  }
};

migration.init(
  connection,
  __dirname + '/migrations',
  function() {},
  [
    "--logger",
    customLogger
  ]
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please leave logging a user's choice

1 participant