HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/zaklada/html/node_modules/gulp-notify/lib/extra_api.js
var fancyLog = require('fancy-log');
var colors = require('ansi-colors');
var notifier = require("node-notifier");
var report = require("./report");

"use strict";

// Default log level
var logLevel = 2;

// Default logger
var fnLog = fancyLog;

var logError = module.exports.logError = function (options, isError) {
  if (!logLevel) return;
  if (logLevel === 1 && !isError) return;

  color = isError ? "red" : "green";
  if (!colors[color]) return;
  fnLog(colors.cyan('gulp-notify') + ':',
           '[' + colors.blue(options.title) + ']',
            colors[color].call(colors, options.message)
           );
};


// Expose onError behaviour
module.exports.onError = function (options, callback) {
  var reporter;
  options = options || {};
  var templateOptions = options.templateOptions || {};
  var callback = callback || function (err) {
    err && logError({
      title: "Error running notifier",
      message: "Could not send message: " + err.message
    }, true);
  };

  if (options.notifier) {
    reporter = options.notifier;
  } else {
    if (options.host || options.appName || options.port) {
      notifier = new notifier.Notification({
        host: options.host || 'localhost',
        appName: options.appName || 'gulp-notify',
        port: options.port || '23053'
      });
    }
    reporter = notifier.notify.bind(notifier);
  }
  return function (error) {
    var self = this;
    report(reporter, error, options, templateOptions, function () {
      callback.apply(self, arguments);
      self.emit && self.emit('end');
    });
  };
};

// Expose to set log level
module.exports.logLevel = function (newLogLevel) {
  if (newLogLevel === void 0) return logLevel;
  logLevel = newLogLevel;
};

// Expose to set new logger
module.exports.logger = function (newLogger) {
  if (!newLogger) return fnLog;
  fnLog = newLogger;
};