import { VERSION } from '../../constants';
import logService from '../logService';

export abstract class BaseService {

    protected abstract logTag: string;

    protected logError(message: string) {
        logService.logError(this.formatMessage(message));
    }

    protected logInfo(message: string) {
        logService.logInfo(this.formatMessage(message));
    }

    protected log(message: string) {
        logService.log(this.formatMessage(message));
    }

    private formatMessage(message: string): string {
        return `Nonstop Javascript SDK : ${VERSION} : ${this.logTag} : ${message}`;
    }
}