*************************************************************************** /* LOGGING AND ERROR REPORTING ***************************************************************************
428447
function(str, debug, error) {
  var pre = '[' + new Date().toISOString() + '] ';
  //pre += (my.name ? '{' + my.name.toUpperCase() + '} ' : '');
  pre += (debug ? 'DEBUG: ' : '');
  str.toString().split('\n').forEach(function(line) {
    if(error)
      console.error(pre + line)
    else if(debug)
      console.log(pre + line);
    else 
      console.log(pre + line);
  });
}
1193202
public function log() {
    if (func_num_args() > 0) {
      foreach (func_get_args() as $argument) {
        if (is_array($argument)) echo print_r($argument,true); else echo $argument;
		echo "<br>\n";
      }
    }
  }
433279
public static void error(Logger log, String methodName, Object... params) {
        log.error(buildMethodLogString(methodName, params));
    }
1329962
public void configLogger()
    {
        Map<String, Level> logLevels = new HashMap<String, Level>();
        logLevels.put("trace", Level.TRACE);
        logLevels.put("debug", Level.DEBUG);
        logLevels.put("info", Level.INFO);
        logLevels.put("warning", Level.WARNING);
        logLevels.put("error", Level.ERROR);

        if( this.get("logging_log_type", "file").equals("file") ){

            DateFormat dateFormat = new SimpleDateFormat(this.get("logging_current_date_format","yyyy-MM-dd"));
            Date date = new Date();
            String logFileName = (this.get("logging_file_format", "current_date").equals("current_date")) ? dateFormat.format(date) + ".log" : this.get("logging_file_format", "current_date") + ".log";
            Configurator.defaultConfig()
                .writer(new FileWriter(this.get("logging_file_path", "src/main/java/resources/") + logFileName, (this.get("logging_buffered", "false").equals("true")) ? true : false, (this.get("logging_append", "true").equals("true")) ? true : false))
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }else if( this.get("logging_log_type", "file").equals("both") ){

            DateFormat dateFormat = new SimpleDateFormat(this.get("logging_current_date_format","yyyy-MM-dd"));
            Date date = new Date();
            String logFileName = (this.get("logging_file_format", "current_date").equals("current_date")) ? dateFormat.format(date) + ".log" : this.get("logging_file_format", "current_date") + ".log";
            Configurator.defaultConfig()
                .writer(new ConsoleWriter())
                .addWriter(new FileWriter(this.get("logging_file_path", "src/main/java/resources/") + logFileName))
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }else{

            Configurator.defaultConfig()
                .writer(new ConsoleWriter())
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }
    }
368970
function debug(msg, error, extra) {
	if (!Manager.root.hasHandlers()) {
		basicConfig();
	}
	Manager.root.debug(msg, error, extra);
}
772367
function Logger (context) {
    var loggerObj, i;

    if (!context || context.length === 0) {
        throw new Error("Invalid 'context' for Logger: " + context);
    }

    loggerObj = {
        debug   : function(scope, message) {
            console.debug(context + separator +
                scope +
                (message && message.length > 0 ? separator + message : "")
            );
        },
        info    : function(scope, message) {
            console.info(context + separator +
                scope +
                (message && message.length > 0 ? separator + message : "")
            );
        },
        warn    : function(scope, message) {
            console.warn(context + separator +
                scope +
                (message && message.length > 0 ? separator + message : "")
            );
        },
        error   : function(scope, message) {
            console.error(context + separator +
                scope +
                (message && message.length > 0 ? separator + message : "")
            );
        }
    };


    return loggerObj;
}
1041059
private void initializeLogging() {
		// Since logging is static, make sure this is done only once even if
		// multiple clients are created (e.g., during tests)
		if (consoleAppender != null) {
			return;
		}

		consoleAppender = new ConsoleAppender();
		consoleAppender.setLayout(new PatternLayout(LOG_PATTERN));
		consoleAppender.setThreshold(Level.INFO);
		LevelRangeFilter filter = new LevelRangeFilter();
		filter.setLevelMin(Level.TRACE);
		filter.setLevelMax(Level.INFO);
		consoleAppender.addFilter(filter);
		consoleAppender.activateOptions();
		org.apache.log4j.Logger.getRootLogger().addAppender(consoleAppender);

		errorAppender = new ConsoleAppender();
		errorAppender.setLayout(new PatternLayout(LOG_PATTERN));
		errorAppender.setThreshold(Level.WARN);
		errorAppender.setTarget(ConsoleAppender.SYSTEM_ERR);
		errorAppender.activateOptions();
		org.apache.log4j.Logger.getRootLogger().addAppender(errorAppender);
	}
964164
public function errorLogger()
    {
        switch ($this->commMethod) {
            case 'liveupdate':
                $orderId = $this->formData['ORDER_REF'];
                $type = "LiveUpdate";
                break;
            case 'backref':
                $orderId = $this->order_ref;
                $type = "BackRef";
                break;
            case 'ios':
                $orderId = $this->orderNumber;
                $type = "IOS";
                break;
            case 'ipn':
                $orderId = @$this->postData['REFNOEXT'];
                $type = "IPN";
                break;
            case 'idn':
                $orderId = $this->refnoext;
                $type = "IDN";
                break;
            case 'irn':
                $orderId = $this->refnoext;
                $type = "IRN";
                break;
            case 'timeout':
                $orderId = $this->order_ref;
                $type = "TIMEOUT";
                break;
            case 'oneclick':
                $orderId = $this->formData['EXTERNAL_REF'];
                $type = "OneClick";
                break;
            case 'alu':
                $orderId = $this->formData['ORDER_REF'];
                $type = "ALU";
                break;

            default:
                $orderId = 'EMPTY';
                $type = 'general';
                $this->debugMessage[] = 'DEBUG_LOGGER_UNDEFINED_ID: ' . $orderId;
                $this->debugMessage[] = 'DEBUG_LOGGER_UNDEFINED_TYPE: ' . $type;
                break;
        }

        $errorCounter = count($this->errorMessage);

        $log = array();
        if ($this->debug || $errorCounter > 0) {
            $counter = 1;
            foreach ($this->debugMessage as $item) {
                $log['ITEM_' . $counter] = $item;
                $counter++;
            }
            $this->logFunc($type . '_DEBUG', $log, $orderId);
        }

        $log = array();
        if ($errorCounter > 0) {
            $counter = 1;
            foreach ($this->errorMessage as $item) {
                $log['ITEM_' . $counter] = $item;
                $counter++;
            }
            $this->logFunc($type . '_ERROR', $log, $orderId);
        }
    }
947111
public function log(): void
    {
        $this->logger->log($this->message(), LOG_ERR, $this->tuple);
    }
507930
function Logger(config) {
    var self    = this;
    var config  = config || {};
    var options = config.options || {};
    var debug   = options.debug || false;
    var dev     = options.dev || false;
    var logging = config.logging || {};

    details = options.debugDetails || false;
    ignored = options.debugIgnore || [];

    if (typeof logging !== 'object') { logging = {}; }

    var enabled = typeof logging.enabled !== 'undefined' ? logging.enabled : false;
    var rewrite = typeof logging.rewrite !== 'undefined' ? logging.rewrite : true;
    var chat    = typeof logging.chat !== 'undefined' ? logging.chat : false;

    timestamp = typeof logging.timestamp !== 'undefined' ? logging.timestamp : true;

    this.options = {
        stream: process.stdout,
        wstream: null,
        level: 'raw'
    };

    if (debug && details) { this.options.level = 'chat'; }
    if (dev) { this.options.level = 'dev'; }
    if (!debug) { this.options.level = 'crash'; }

    if (enabled) {
        ensureExists('./logs', function(err) {
            if (!err) {
                var flag = rewrite ? 'w' : 'a';
                var stream = filesystem.createWriteStream('./logs/status.log', { flags: flag });
                self.options.wstream = stream;
                if (chat) { self.options.level = 'chat'; }
            }
        });
    }

    this.templates = {
        chat:  '[:timestamp] \x1b[35mchat\x1b[39m   - :message',
        action:  '[:timestamp] \x1b[35maction\x1b[39m - :message',
        dev:   '\x1b[90m  :message\x1b[39m',
        raw:   '[:timestamp] \x1b[36mraw\x1b[39m    - :message',
        event: '[:timestamp] \x1b[32mevent\x1b[39m  - :message',
        info:  '[:timestamp] \x1b[33minfo\x1b[39m   - :message',
        error: '[:timestamp] \x1b[31merror\x1b[39m  - :message',
        crash: '[:timestamp] \x1b[31merror\x1b[39m  - :message',
        inspect: true
    };
}
1331179
function Logs(beyond) {
        "use strict";
    
        var style = 'style="';
        style += 'position: absolute;';
        style += 'bottom: 40px; left: 10px; right: 10px;';
        style += 'z-index: 10000;';
        style += 'background: #c7c7c7;';
        style += 'border: 1px solid #333;';
        style += 'padding: 5px;';
        style += 'border-radius: 3px';
        style += 'color: white;';
        style += '"';
    
        var $log = $('<div ' + style + ' />')
            .addClass('log')
            .hide();
    
        $('body').append($log);
    
        this.append = function (msg) {
    
            var $msg = $('<div />').html(msg);
            $log.append($msg);
    
            if (beyond.params.showLogs) {
                this.show();
            }
    
        };
    
        var timer;
        this.show = function () {
    
            $log.show();
    
            clearTimeout(timer);
            timer = setTimeout(Delegate(this, function () {
                this.hide();
            }), 5000);
    
        };
    
        this.hide = function () {
            $log.hide();
        };
    
        if (beyond.params.showLogs) {
            window.onError = function (message, url, line) {
                beyond.logs.append(message + ' - ' + url + ' - on line: ' + line);
            };
        }
    
    }
338218
public void log(Logger log)
    {
        // only print overflow if there is any
        int nameCount;
        if (buckets.get(buckets.length() - 1) == 0)
            nameCount = buckets.length() - 1;
        else
            nameCount = buckets.length();
        String[] names = new String[nameCount];

        int maxNameLength = 0;
        for (int i = 0; i < nameCount; i++)
        {
            names[i] = nameOfRange(bucketOffsets, i);
            maxNameLength = Math.max(maxNameLength, names[i].length());
        }

        // emit log records
        String formatstr = "%" + maxNameLength + "s: %d";
        for (int i = 0; i < nameCount; i++)
        {
            long count = buckets.get(i);
            // sort-of-hack to not print empty ranges at the start that are only used to demarcate the
            // first populated range. for code clarity we don't omit this record from the maxNameLength
            // calculation, and accept the unnecessary whitespace prefixes that will occasionally occur
            if (i == 0 && count == 0)
                continue;
            log.debug(String.format(formatstr, names[i], count));
        }
    }
876488
function Logger() {
  this._level = LEVELS.NOTICE;
  this._out = process.stdout;
  this._err = process.stderr;

  /* istanbul ignore next: allow server to suppress logs */
  if(process.env.NODE_ENV === Constants.TEST && !process.env.TEST_DEBUG) {
    this.log = function noop(){};
  }
}
539403
function log(err) {
    if (_logger) {
      if (typeof(err) == 'string') {
        err = { message: err, code: 0 }
      }
      _logger(err);
    }
  }
541466
public function log(): void
    {
        if (file_exists(FLOW_PATH_DATA . 'Logs/Elasticsearch') && is_dir(FLOW_PATH_DATA . 'Logs/Elasticsearch') && is_writable(FLOW_PATH_DATA . 'Logs/Elasticsearch')) {
            file_put_contents($this->filename, $this->renderErrors());
            $this->logger->log($this->message, LOG_ERR, [], 'Flowpack.ElasticSearch.ContentRepositoryAdaptor', __CLASS__, __FUNCTION__);
        } else {
            $this->logger->log(sprintf('Could not write indexing errors backtrace into %s because the directory could not be created or is not writable.', FLOW_PATH_DATA . 'Logs/Elasticsearch/'), LOG_WARNING, [], 'Flowpack.ElasticSearch.ContentRepositoryAdaptor', __CLASS__, __FUNCTION__);
        }
    }
665288
function log(type, ...args) {
    // The stack type allows to filter logs in testing
    // since the stack files paths vary between systems
    if (debug && ('debug' === type || 'stack' === type)) {
      debug(...args);
      return;
    }
    logger[logger[type] ? type : 'error'](...args);
  }
542895
function processLogs() {
  var calcs = 0;
  for (var i in stats) {
    stats[i].average = stats[i].totalTime / stats[i].count;
    calcs += stats[i].calcs;
  }
  var time1 = meaningfulTime();
  var time2 = meaningfulTime();
  console.error("TRACER TOTAL OVERHEAD", (calcs*timeDiff(time2, time1)).toFixed(2)+'ms');

  while (Object.keys(stats).length > 0) {
    var biggest = 0;
    var biggestPath = Object.keys(stats)[0];
    for (var path in stats) {
      if (stats[path].average >= biggest) {
        biggestPath = path;
        biggest = stats[path].average;
      }
    }
    console.error("TRACER TOTAL",
                  stats[biggestPath].min.toFixed(2)+'ms',
                  stats[biggestPath].average.toFixed(2)+'ms',
                  stats[biggestPath].max.toFixed(2)+'ms',
                  stats[biggestPath].count,
                  biggestPath);
    delete stats[biggestPath];
  }
}