Code coverage report for ./src/client/app/blocks/logger/logger.js

Statements: 66.67% (12 / 18)      Branches: 100% (0 / 0)      Functions: 50% (3 / 6)      Lines: 66.67% (12 / 18)      Ignored: none     

All files » ./src/client/app/blocks/logger/ » logger.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 481     1       1     1 17                       17     1         1 3 3     1         1            
(function() {
    'use strict';
 
    angular
        .module('blocks.logger')
        .factory('logger', logger);
 
    logger.$inject = ['$log', 'toastr'];
 
    /* @ngInject */
    function logger($log, toastr) {
        var service = {
            showToasts: true,
 
            error   : error,
            info    : info,
            success : success,
            warning : warning,
 
            // straight to console; bypass toastr
            log     : $log.log
        };
 
        return service;
        /////////////////////
 
        function error(message, data, title) {
            toastr.error(message, title);
            $log.error('Error: ' + message, data);
        }
 
        function info(message, data, title) {
            toastr.info(message, title);
            $log.info('Info: ' + message, data);
        }
 
        function success(message, data, title) {
            toastr.success(message, title);
            $log.info('Success: ' + message, data);
        }
 
        function warning(message, data, title) {
            toastr.warning(message, title);
            $log.warn('Warning: ' + message, data);
        }
    }
}());