smartlog-destination-local/ts/beautylog.remote.ts
2017-01-21 01:05:28 +01:00

39 lines
850 B
TypeScript

import * as plugins from './beautylog.plugins'
let client
let clientData = {
serverName: 'myServer',
applicationName: 'myApp',
message: 'undefined',
messageType: 'undefined'
}
export let remoteLog = (logType: string, logMessage: string) => {
clientData.messageType = logType
clientData.message = logMessage
if (client) {
client.log(clientData)
};
}
// Service implementations
let loggly = (optionsArg: {
token: string,
subdomain: string,
appName: string,
serverName: string
}) => {
client = plugins.loggly.createClient({
token: optionsArg.token,
subdomain: optionsArg.subdomain,
tags: [],
json: true
})
clientData.applicationName = optionsArg.appName
clientData.serverName = optionsArg.serverName
}
export let remote = {
loggly: loggly
}