Logger

An object that can be passed to logger to control how Sass emits warnings and debug messages.

Example

const fs = require('fs');
const sass = require('sass');

let log = "";
sass.renderSync({
file: 'input.scss',
logger: {
warn(message, options) {
if (options.span) {
log += `${span.url}:${span.start.line}:${span.start.column}: ` +
`${message}\n`;
} else {
log += `::: ${message}\n`;
}
}
}
});

fs.writeFileSync('log.txt', log);

Hierarchy

  • Logger

Methods

Methods

  • This method is called when Sass emits a debug message due to a @debug rule.

    If this is undefined, Sass will print debug messages to standard error.

    Parameters

    • message: string

      The debug message.

    • options: {
          span: SourceSpan;
      }
      • span: SourceSpan

        The location in the Sass source code that generated this debug message.

    Returns void

  • This method is called when Sass emits a warning, whether due to a @warn rule or a warning generated by the Sass compiler.

    If this is undefined, Sass will print warnings to standard error.

    Parameters

    • message: string

      The warning message.

    • options: Object

    Returns void