smartlog-destination-local/ts/beautylog.remote.ts

38 lines
885 B
TypeScript
Raw Normal View History

2016-07-23 23:17:38 +00:00
import * as plugins from "./beautylog.plugins";
let client;
let clientData = {
2016-07-23 23:30:30 +00:00
serverName: "myServer",
applicationName: "myApp",
message: "undefined",
messageType: "undefined"
2016-07-23 23:17:38 +00:00
}
2016-07-23 23:30:30 +00:00
export let remoteLog = (logType: string, logMessage: string) => {
2016-07-23 23:17:38 +00:00
clientData.messageType = logType;
clientData.message = logMessage;
2016-07-23 23:30:30 +00:00
if (client) {
client.log(clientData);
2016-07-23 23:17:38 +00:00
};
}
// Service implementations
2016-07-23 23:30:30 +00:00
let loggly = (optionsArg: {
customerTokenArg: string,
subdomainArg: string,
appName: string,
serverName:string
}) => {
2016-07-23 23:17:38 +00:00
client = plugins.loggly.createClient({
2016-07-23 23:30:30 +00:00
token: optionsArg.customerTokenArg,
subdomain: optionsArg.subdomainArg,
tags: [],
json: true
2016-07-23 23:17:38 +00:00
});
2016-07-23 23:30:30 +00:00
clientData.applicationName = optionsArg.appName;
clientData.serverName = optionsArg.serverName;
2016-07-23 23:17:38 +00:00
}
export let remote = {
loggly: loggly
};