Skip to content
Angular 1 logging module supporing integration
Branch: master
Clone or download
Latest commit ad5c607 May 15, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
logging Initial commit May 15, 2017
LICENSE Initial commit May 15, 2017 Initial commit May 15, 2017


Angular 1 (currently using 1.3.20) logging module supporing integration


This example module is a working module used in our application, but I haven't had time to "bowerize" it into a module. This should drop into an existing angular 1 application with minimal effort.


  • stacktrace.js -- used to parse .map files and report source errors (currently using version 1.1.0)
  • ng-lodash -- used for the omit feature below (currently using verison 0.5.0)


  • $log messages are batch posted based on buffering
  • Intercepts errors and reports as level:error messages


This module is heavily stolen from various online blogs/examples, none of which I rememberd to include in my code. The core of my enhancement is the logzio.factory.js file, which is the magic that posts the data to This factory may be lifted and inserted into your logging system to support


The following is a real screenshot that was generated by an error in the application.

Angular Error


Enable the factory as follows:

    api_key:          '**YOUR_LOGZIO_TOKEN**',
    enable_xhr:       true,
    enable_exception: true,
    log_level:        'info',
    source_prefix:    '../../../client/app/',

The above configuration:

  • Publishes all $ messages to
  • All exceptions and xhr errors are reported
  • file references our source code at "../../../client/app" (this is build-system specific, so your mileage may vary)


The default configuration variable is:

api_key:                 null,
logzio_type:             "angular",
exception_logger_config: {
    windowInSeconds:        5,
    maxExceptionsPerWindow: 4, //max # of exceptions we log in the window interval
omit: [
enable_xhr:              false,
enable_exception:        false,
log_logger_config:       {
    global: false,
    warn:   true,
    error:  true,
    info:   true,
    log:    false,
    debug:  false
baseMeta:                {},
delay_timing:            5000,
source_prefix:           '',


  • windowInSeconds: Throttles errors to 5s. If multiple errors are generated within a 5s window, only the first 4 are reported (this prevents flooding
  • delay_timing: This buffers messages for 5s and then posts to
  • omit: If you

To disable locally:

    log_level: 'off'

Metadata for Searching

You may have some metadata information for your application (a JSON object) that you wish to include in each log message (for searching). Configure this meta information as follows (in your initialization routine):

var meta = {
    role: 'angular'
if ($rootScope.currentUser) {
    meta.username = $rootScope.currentUser.username;
    meta.env      = $rootScope.currentUser.node_env;
    baseMeta: meta


You can’t perform that action at this time.