Name

sn_oe_sfs.VACommonLogger

Description

No description available

Script

var VACommonLogger = Class.create();

VACommonLogger.prototype = {
  initialize: function(channelLogger, source) {
      this.source = 'VACommon';
      if (source)
          this.source = source;

      if (this.isUnifiedLoggingEnabled()) {
          this.logger = new sn_log.GlideLogger(this.source, channelLogger.getInitContext(), channelLogger.getInitContextAttributes());
      }
  },

  debug: function(msg, args) {
      if (this.isUnifiedLoggingEnabled()) {
          this.logger.debug(msg, args);
      } else {
          gs.debug(this._getFormattedString(msg), args);
      }
  },

  info: function(msg, args) {
      if (this.isUnifiedLoggingEnabled()) {
          this.logger.info(msg, args);
      } else {
          gs.info(this._getFormattedString(msg), args);
      }
  },

  warn: function(msg, args) {
      if (this.isUnifiedLoggingEnabled()) {
          this.logger.warn(msg, args);
      } else {
          gs.warn(this._getFormattedString(msg), args);
      }
  },

  error: function(msg, args) {
      if (this.isUnifiedLoggingEnabled()) {
          this.logger.error(msg, args);
      } else {
          gs.error(this._getFormattedString(msg), args);
      }
  },

  isUnifiedLoggingEnabled: function() {
      var flag = gs.getProperty("com.glide.cs.unified_logging.store.app.enabled", false);
      return flag == "true" || flag == true;
  },

  _getFormattedString: function(msg) {
      return this.source + " :: " + msg;
  },

  addToLoggerContext: function(context) {
      if (this.isUnifiedLoggingEnabled()) {
          var ctx = new sn_log.GlideLogContext(context);
      }
  },

  type: 'VACommonLogger'
};

Sys ID

4a88d3ad73df811065afe3d29f148b0f

Offical Documentation

Official Docs: