 *
 */
export class LoggedError extends Error {
    /**
     * @property logged
     */
    logged = false;

    constructor(error: LoggerMessage, level: number = LOGGER_LEVELS.ERROR) {
        super(error instanceof Error ? error.message : error);
        this.logged = error instanceof LoggedError && error.logged;
        if (!this.logged)
            getLogger().report(error, level);
    }
}