[ADF-2905] Added JSDocs for core (#3281)

* [ADF-2905] Updated JSDocs for core

* [ADF-2905] Added missing JSDoc for user pref service
This commit is contained in:
Andy Stark
2018-05-08 15:30:23 +01:00
committed by Eugenio Romano
parent d456b3cba1
commit dd1b8893cc
10 changed files with 102 additions and 7 deletions

View File

@@ -41,6 +41,11 @@ export class LogService {
this.onMessage = new Subject();
}
/**
* Logs a message at the "ERROR" level.
* @param message Message to log
* @param optionalParams Interpolation values for the message in "printf" format
*/
error(message?: any, ...optionalParams: any[]) {
if (this.currentLogLevel >= LogLevelsEnum.ERROR) {
@@ -50,6 +55,11 @@ export class LogService {
}
}
/**
* Logs a message at the "DEBUG" level.
* @param message Message to log
* @param optionalParams Interpolation values for the message in "printf" format
*/
debug(message?: any, ...optionalParams: any[]) {
if (this.currentLogLevel >= LogLevelsEnum.DEBUG) {
@@ -59,6 +69,11 @@ export class LogService {
}
}
/**
* Logs a message at the "INFO" level.
* @param message Message to log
* @param optionalParams Interpolation values for the message in "printf" format
*/
info(message?: any, ...optionalParams: any[]) {
if (this.currentLogLevel >= LogLevelsEnum.INFO) {
@@ -68,6 +83,11 @@ export class LogService {
}
}
/**
* Logs a message at any level from "TRACE" upwards.
* @param message Message to log
* @param optionalParams Interpolation values for the message in "printf" format
*/
log(message?: any, ...optionalParams: any[]) {
if (this.currentLogLevel >= LogLevelsEnum.TRACE) {
@@ -77,6 +97,11 @@ export class LogService {
}
}
/**
* Logs a message at the "TRACE" level.
* @param message Message to log
* @param optionalParams Interpolation values for the message in "printf" format
*/
trace(message?: any, ...optionalParams: any[]) {
if (this.currentLogLevel >= LogLevelsEnum.TRACE) {
@@ -86,6 +111,11 @@ export class LogService {
}
}
/**
* Logs a message at the "WARN" level.
* @param message Message to log
* @param optionalParams Interpolation values for the message in "printf" format
*/
warn(message?: any, ...optionalParams: any[]) {
if (this.currentLogLevel >= LogLevelsEnum.WARN) {
@@ -95,6 +125,12 @@ export class LogService {
}
}
/**
* Logs a message if a boolean test fails.
* @param test Test value (typically a boolean expression)
* @param message Message to show if test is false
* @param optionalParams Interpolation values for the message in "printf" format
*/
assert(test?: boolean, message?: string, ...optionalParams: any[]) {
if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
@@ -104,18 +140,31 @@ export class LogService {
}
}
/**
* Starts an indented group of log messages.
* @param groupTitle Title shown at the start of the group
* @param optionalParams Interpolation values for the title in "printf" format
*/
group(groupTitle?: string, ...optionalParams: any[]) {
if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
console.group(groupTitle, ...optionalParams);
}
}
/**
* Ends a indented group of log messages.
*/
groupEnd() {
if (this.currentLogLevel !== LogLevelsEnum.SILENT) {
console.groupEnd();
}
}
/**
* Converts a log level name string into its numeric equivalent.
* @param level Level name
* @returns Numeric log level
*/
getLogLevel(level: string): LogLevelsEnum {
let referencedLevel = logLevels.find((currentLevel: any) => {
return currentLevel.name.toLocaleLowerCase() === level.toLocaleLowerCase();
@@ -124,6 +173,11 @@ export class LogService {
return referencedLevel ? referencedLevel.level : 5;
}
/**
* Triggers notification callback for log messages.
* @param text Message text
* @param logLevel Log level for the message
*/
messageBus(text: string, logLevel: string) {
this.onMessage.next({ text: text, type: logLevel });
}