js/sys/siteapp.log.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 1.6

Size

Lines of Code 22
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 22
rs 10
wmc 8
mnd 1
bc 9
fnc 5
bpm 1.8
cpm 1.6
noi 4

5 Functions

Rating   Name   Duplication   Size   Complexity  
A siteapp.log.js ➔ ??? 0 7 2
A Log.clear 0 1 1
A Log.get 0 1 2
A Log.log 0 1 1
A Log.setLevel 0 1 2
1
/**
2
 * [Siteapp] - multi-purpose frontend application
3
 * 
4
 * Siteapp application logger
5
 *     
6
 * @package     [Siteapp]
7
 * @subpackage  [Siteapp] core
8
 * @author      Björn Bartels <[email protected]>
9
 * @link        https://gitlab.bjoernbartels.earth/groups/themes
10
 * @license     http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
11
 * @copyright   copyright (c) 2016 Björn Bartels <[email protected]>
12
 * 
13
 * @namespace   Siteapp
14
 * @module      Siteapp.Log
15
 */
16
	
17
var Log = {
18
	logentries		: [],
19
	loglevel		: 0,
20
	logtypes		: ['debug','info','warn','exception'],
21
	_currentIndex	: 0,
22
23
	log				: function ( message, type, context ) { this.logentries.push(arguments); return (this); },
0 ignored issues
show
Unused Code introduced by
The parameter context is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter type is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Unused Code introduced by
The parameter message is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
24
	get				: function () { return (arguments.length > 0) ? this.logentries[parseInt(arguments[0])] : this.logentries; },
25
	clear			: function () { this.logentries = []; this._currentIndex = 0; return (this); },
26
27
	setLevel		: function () { if (arguments.length > 0) { this.loglevel = parseInt(arguments[0]); } else { this.loglevel = 0; } return (this); },
28
	
29
	_app : ( context ) => {
30
		if (context) {
31
			this.__app = context;
0 ignored issues
show
Best Practice introduced by
There is no return statement in this branch, but you do return something in other branches. Did you maybe miss it? If you do not want to return anything, consider adding return undefined; explicitly.
Loading history...
32
		} else {
33
			return this.__app;
34
		}
35
    }
36
};
37
38
export {Log};
39