fix(core): update

This commit is contained in:
2018-11-03 23:31:26 +01:00
parent 99bfc485cf
commit 6c471f3722
5 changed files with 36 additions and 20 deletions

View File

@@ -1,18 +1,19 @@
import * as plugins from './logdna.plugins';
import { LogdnaMessage } from './logdna.classes.logmessage';
import { ILogPackage } from '@pushrocks/smartlog-interfaces';
/**
* the main logdna account
*/
export class LogdnaAccount {
apiKey: string;
baseUrl = 'https://logs.logdna.com/logs/ingest';
private apiKey: string;
private baseUrl = 'https://logs.logdna.com/logs/ingest';
/**
* Create basic authentication
*/
createBasicAuth() {
private createBasicAuth() {
const userNamePasswordString = `${this.apiKey}:`;
return `Basic ${plugins.smartstring.base64.encode(userNamePasswordString)}`;
}
@@ -66,4 +67,11 @@ export class LogdnaAccount {
requestBody: requestBodyObject
});
}
/**
* convenience function for smartlog
*/
async sendSmartlogPackage (smartlogPackageArg: ILogPackage) {
this.sendLogDnaMessage(LogdnaMessage.fromSmartLogPackage(smartlogPackageArg));
}
}