View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page


Configuration for the instance of the Sails logger (sails.log) used in your Sails app. The options are conventionally specified in the config/log.js configuration file.


Property Type Default Details
level 'info' Set the level of detail to be shown in your app's log
inspect true Set to false to disable captain's log's handling of logging, logs will instead be passed to the configured custom logger
custom undefined Set to the instance of a custom logger (such as winston) logs will be passed through to the custom logger

Using a Custom Logger

You can use a custom logger by disabling captain's log and providing a logger with similar methods that logs can be passed to. An example using winston defining both a console transport and file transport is below.

var winston = require('winston');
var customLogger = new winston.Logger();

// A console transport logging debug and above.
customLogger.add(winston.transports.Console, {
  level: 'debug',
  colorize: true

// A file based transport logging only errors formatted as json.
customLogger.add(winston.transports.File, {
  level: 'error',
  filename: 'filename.log',
  json: true

module.exports.log = {
  // Pass in our custom logger, and pass all log levels through.
  custom: customLogger,
  level: 'silly',

  // Disable captain's log so it doesn't prefix or stringify our meta data.
  inspect: false

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.


We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book