How to use the strapi-utils.logger function in strapi-utils

To help you get started, we’ve selected a few strapi-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / packages / strapi / bin / strapi-generate.js View on Github external
#!/usr/bin/env node

'use strict';

/**
 * Module dependencies
 */

// Node.js core.
const path = require('path');

// Master of ceremonies for generators.
const generate = require('strapi-generate');

// Logger.
const logger = require('strapi-utils').logger;

/**
 * `$ strapi generate`
 *
 * Scaffolding for the application in our working directory.
 */

module.exports = function () {

  // Pass the original CLI arguments down to the generator
  // (but first, remove commander's extra argument).
  const cliArguments = Array.prototype.slice.call(arguments);
  cliArguments.pop();

  // Build initial scope.
  const scope = {
github strapi / strapi / packages / strapi-hook-redis / lib / utils / connectivity.js View on Github external
'use strict';

/* eslint-disable import/no-unresolved */
// Node.js core.
const execSync = require('child_process').execSync;

// Logger.
const logger = require('strapi-utils').logger;

module.exports = (scope, success, error) => {
  const Redis = require(`${scope.tmpPath}/node_modules/ioredis`);
  const redis = new Redis({
    port: scope.database.settings.port,
    host: scope.database.settings.host,
    password: scope.database.settings.password,
    db: scope.database.settings.database
  });

  redis.connect((err) => {
    redis.disconnect();

    if (err) {
      logger.warn('Database connection has failed! Make sure your database is running.');
      return error();
github strapi / strapi / packages / strapi / bin / strapi-migrate-rollback.js View on Github external
#!/usr/bin/env node

'use strict';

/**
 * Module dependencies
 */

// Node.js core.
const path = require('path');

// Helpers.
const logger = require('strapi-utils').logger;

// Is the connection valid?
const knex = require('strapi-utils').knex;

/**
 * `$ strapi migrate:run`
 *
 * Run migrations for a specified connection.
 */

module.exports = function () {

  // Pass the original CLI arguments down to the generator.
  const cliArguments = Array.prototype.slice.call(arguments);

  // Build initial scope.
github strapi / strapi / packages / strapi-generate / lib / index.js View on Github external
'use strict';

/**
 * Module dependencies
 */

// Public node modules.
const reportback = require('reportback')();

// Logger.
const logger = require('strapi-utils').logger;

// Local dependencies.
const generate = require('./generate');
const generateTarget = require('./target');

/* eslint-disable prefer-template */
/**
 * Generate module(s)
 *
 * @param {Object} scope
 * @param {Function} cb
 *
 * @return {[Type]}
 */

module.exports = (scope, cb) => {
github strapi / strapi / packages / strapi / bin / strapi-console.js View on Github external
#!/usr/bin/env node

'use strict';

/**
 * Module dependencies
 */

// Node.js core.
const REPL = require('repl');

// Local Strapi dependencies.
const strapi = require('../lib/');

// Logger.
const logger = require('strapi-utils').logger;

/**
 * `$ strapi console`
 *
 * Enter the interactive console (aka REPL) for the application
 * in our working directory.
 */

module.exports = function () {

  // Only log if the process is a master.
  strapi.log.info('Starting the application in interactive mode...');

  strapi.start({}, err => {

    // Log and exit the REPL in case there is an error
github strapi / strapi / packages / strapi / bin / strapi-new.js View on Github external
/**
 * Module dependencies
 */

// Node.js core.
const path = require('path');

// Master of ceremonies for generators.
const generate = require('strapi-generate');

// Local Strapi dependencies.
const packageJSON = require('../package.json');

// Logger.
const logger = require('strapi-utils').logger;

/**
 * `$ strapi new`
 *
 * Generate a new Strapi application.
 */

module.exports = function () {

  // Pass the original CLI arguments down to the generator
  // (but first, remove commander's extra argument).
  const cliArguments = Array.prototype.slice.call(arguments);
  cliArguments.pop();

  // Build initial scope.
  const scope = {
github strapi / strapi / packages / strapi / bin / strapi-migrate-run.js View on Github external
#!/usr/bin/env node

'use strict';

/**
 * Module dependencies
 */

// Node.js core.
const path = require('path');

// Logger.
const logger = require('strapi-utils').logger;

// Is the connection valid?
const knex = require('strapi-utils').knex;

/**
 * `$ strapi migrate:run`
 *
 * Run migrations for a specified connection.
 */

module.exports = function () {
  // Pass the original CLI arguments down to the generator.
  const cliArguments = Array.prototype.slice.call(arguments);

  // Build initial scope.
  const scope = {
github strapi / strapi / packages / strapi / bin / strapi-update.js View on Github external
'use strict';

/**
 * Module dependencies
 */

// Node.js core.
const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;

// Public node modules.
const _ = require('lodash');

// Logger.
const logger = require('strapi-utils').logger;

/**
 * `$ strapi update`
 *
 * Pull latest update from custom generators
 * readed from the RC file at $HOME.
 */

module.exports = function () {
  const HOME = process.env[process.platform === 'win32' ? 'USERPROFILE' : 'HOME'];

  fs.access(path.resolve(HOME, '.strapirc'), fs.F_OK | fs.R_OK | fs.W_OK, function (err) {
    if (err) {
      if (err.code === 'ENOENT') {
        logger.error('No `.strapirc` file detected at `' + HOME + '`.');
        logger.error('Execute `$ strapi config` to create one.');
github strapi / strapi / packages / strapi / bin / strapi-migrate-rollback.js View on Github external
#!/usr/bin/env node

'use strict';

/**
 * Module dependencies
 */

// Node.js core.
const path = require('path');

// Helpers.
const logger = require('strapi-utils').logger;

// Is the connection valid?
const knex = require('strapi-utils').knex;

/**
 * `$ strapi migrate:run`
 *
 * Run migrations for a specified connection.
 */

module.exports = function () {

  // Pass the original CLI arguments down to the generator.
  const cliArguments = Array.prototype.slice.call(arguments);

  // Build initial scope.
github strapi / strapi / packages / strapi / bin / strapi-migrate-make.js View on Github external
#!/usr/bin/env node

'use strict';

/**
 * Module dependencies
 */

// Node.js core.
const path = require('path');

// Master of ceremonies for generators.
const generate = require('strapi-generate');

// Logger.
const logger = require('strapi-utils').logger;

// Is the connection valid?
const knex = require('strapi-utils').knex;

/**
 * `$ strapi migrate:make`
 *
 * Generate migration files for a specified connection.
 */

module.exports = function () {

  // Pass the original CLI arguments down to the generator.
  const cliArguments = Array.prototype.slice.call(arguments);

  // Build initial scope.