View source Improve this doc

# `$log`
service in module `ngMock`

## Description

Mock implementation of `ng.$log` that gathers all logged messages in arrays (one array per logging level). These arrays are exposed as `logs` property of each of the level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`.

## Methods

- ### assertEmpty()

  Assert that the all of the logging methods have no logged messages. If messages present, an exception is thrown.

- ### reset()

  Reset all of the logging arrays to empty.

## Properties

- ### logs

  Array of messages logged using ngMock.$log#debug.

  #### Example

      $log.debug('Some Error');
      var first = $log.debug.logs.unshift();

- ### logs

  Array of messages logged using ngMock.$log#error.

  #### Example

      $log.log('Some Error');
      var first = $log.error.logs.unshift();

- ### logs

  Array of messages logged using ngMock.$log#info.

  #### Example

      $log.info('Some Info');
      var first = $log.info.logs.unshift();

- ### logs

  Array of messages logged using ngMock.$log#log.

  #### Example

      $log.log('Some Log');
      var first = $log.log.logs.unshift();

- ### logs

  Array of messages logged using ngMock.$log#warn.

  #### Example

      $log.warn('Some Warning');
      var first = $log.warn.logs.unshift();