Module: alfresco/services/LoggingService

alfresco/services/LoggingService

This service can be included on a page to handle log messages generated through calls to the alfLog function. It can either be configured (either through user preferences or directly) to filter the messages that displayed in the browser console.
Author:
  • Dave Draper
License:
Source:

Examples

Example configuration to enable all logs

{
  name: "alfresco/services/LoggingService",
  config: {
    loggingPreferences: {
      enabled: true,
      all: true
    }
  }
}

Example configuration to show only warnings and errors

{
  name: "alfresco/services/LoggingService",
  config: {
    loggingPreferences: {
      enabled: true,
      all: false,
      warn: true,
      error: true
    }
  }
}

Example configuration to show only publication and subscription messages

{
  name: "alfresco/services/LoggingService",
  config: {
    loggingPreferences: {
      enabled: true,
      all: false,
      pubSub: true
    }
  }
}

Example configuration to show all logs that match a custom Regular Expression filter

{
  name: "alfresco/services/LoggingService",
  config: {
    loggingPreferences: {
      enabled: true,
      all: true,
      filter: "afresco/core/(.*)"
    }
  }
}

Members

detailsDialog :object

This attribute is used to hold a reference to a dialog that can be used to set more granular logging information (e.g. wildcard style matches for widgets and functions). It is set on the first call to the onDetailsDialog function.
Type:
  • object
Default Value:
  • null
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/LoggingService.properties"}]
Source:

loggingPreferences :object

The local copy of logging preferences.
Type:
  • object
Default Value:
  • null
Source:

loggingPreferencesId :string

Type:
  • string
Default Value:
  • "org.alfresco.share.logging"
Source:

logSubscriptionHandle :object

This will hold a reference to the subscription to log events. It will be null unless logging is enabled.
Type:
  • object
Default Value:
  • null
Source:

suppressUserPreferences :boolean

Indicates whether or not the user preferences for logging should be suppressed. If this is set to true then a request will not be made to retrieve the user preferences for logging.
Type:
  • boolean
Since:
  • 1.0.36
Default Value:
  • false
Source:

Methods

handleSubscription()

Updates the subscription to the logging topic. Checks each subscription individually and only subscribes if one doesn't already exist.
Source:
Listens to Events:

onDetailsDialog(payload)

Parameters:
Name Type Description
payload object
Source:

onLoggingStatusChange(payload)

Handles requests to change the current logging status.
Parameters:
Name Type Description
payload object
Source:
Fires:
  • event:setPreferenceTopic

onLogRequest(payload)

onLogRequest
Parameters:
Name Type Description
payload logPayload
Source:

onPrefsUpdateCancel(payload)

Parameters:
Name Type Description
payload object
Source:

onPrefsUpdateSave(payload)

Parameters:
Name Type Description
payload object
Source:

passesLoggingFilter(callerName) → {boolean}

Checks to see whether or not the current log request caller passes the logging filter.
Parameters:
Name Type Description
callerName string The name of the function requesting logging.
Source:
Returns:
true if the filter passes and false otherwise
Type
boolean

registerSubscriptions()

Sets up the subscriptions for the LoggingService
Since:
  • 1.0.32
Source:
Fires:
  • module:alfresco/core/topics#event:GET_PREFERENCE
Listens to Events:
  • event:ALF_LOGGING_STATUS_CHANGE
  • event:ALF_UPDATE_LOGGING_PREFERENCES
  • event:ALF_SHOW_PUBSUB_LOG
  • event:ALF_SHOW_DATA_MODEL
  • event:ALF_TOGGLE_DEVELOPER_MODE

setLoggingStatus(value)

Parameters:
Name Type Description
value boolean Indicates whether or not to enable or disable logging.
Source:

showDataModel(payload)

This displays a dialog that displays the current data model built up through the use of the CoreData singleton.
Parameters:
Name Type Description
payload object The request payload
Source:

showPubSubLog(payload)

Parameters:
Name Type Description
payload object
Source:

toggleDeveloperMode()

Switches into the developer mode that gives an exploded view of the widgets on the page.
Source:

<inner> onPubSubLogRequest(type, payload, caller)

This logging is explicitly for publication, subscription and unsubscription events.
Parameters:
Name Type Argument Description
type string This is the PubSub activity type (e.g. "SUBSCRIPTION", "PUBLICATION", etc).
payload object The details of the PubSub activity
caller object <optional>
A reference to the object that published the event
Source:

Events

cancelLoggingPrefsUpdateTopic

This is the topic used to subscribe to requests to cancel logging preferences updates set in the preferences dialog.
Type:
  • string
Default Value:
  • "ALF_CANCEL_LOGGING_PREFERNCES_UPDATE"
Source:

saveLoggingPrefsUpdateTopic

This is the topic used to subscribe to requests to save logging preferences updated by the preferences dialog.
Type:
  • string
Default Value:
  • "ALF_SAVE_LOGGING_PREFERNCES_UPDATE"
Source: