Refactor: Make exported log-types implement interface

Change-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
Cameron Diver 2018-08-26 17:16:21 -07:00
parent 8ee26adbbe
commit 99c807a48c
No known key found for this signature in database
GPG Key ID: 69264F9C923F55C1

View File

@ -1,169 +1,174 @@
export const stopService= { export interface LogType {
eventName: string;
humanName: string;
}
export const stopService: LogType = {
eventName: 'Service kill', eventName: 'Service kill',
humanName: 'Killing service', humanName: 'Killing service',
}; };
export const stopServiceSuccess= { export const stopServiceSuccess: LogType = {
eventName: 'Service stop', eventName: 'Service stop',
humanName: 'Killed service', humanName: 'Killed service',
}; };
export const stopServiceNoop = { export const stopServiceNoop: LogType = {
eventName: 'Service already stopped', eventName: 'Service already stopped',
humanName: 'Service is already stopped, removing container', humanName: 'Service is already stopped, removing container',
}; };
export const stopRemoveServiceNoop = { export const stopRemoveServiceNoop: LogType = {
eventName: 'Service already stopped and container removed', eventName: 'Service already stopped and container removed',
humanName: 'Service is already stopped and the container removed', humanName: 'Service is already stopped and the container removed',
}; };
export const stopServiceError = { export const stopServiceError: LogType = {
eventName: 'Service stop error', eventName: 'Service stop error',
humanName: 'Failed to kill service', humanName: 'Failed to kill service',
}; };
export const removeDeadService = { export const removeDeadService: LogType = {
eventName: 'Remove dead container', eventName: 'Remove dead container',
humanName: 'Removing dead container', humanName: 'Removing dead container',
}; };
export const removeDeadServiceError = { export const removeDeadServiceError: LogType = {
eventName: 'Remove dead container error', eventName: 'Remove dead container error',
humanName: 'Error removing dead container', humanName: 'Error removing dead container',
}; };
export const downloadImage = { export const downloadImage: LogType = {
eventName: 'Docker image download', eventName: 'Docker image download',
humanName: 'Downloading image', humanName: 'Downloading image',
}; };
export const downloadImageDelta = { export const downloadImageDelta: LogType = {
eventName: 'Delta image download', eventName: 'Delta image download',
humanName: 'Downloading delta for image', humanName: 'Downloading delta for image',
}; };
export const downloadImageSuccess = { export const downloadImageSuccess: LogType = {
eventName: 'Image downloaded', eventName: 'Image downloaded',
humanName: 'Downloaded image', humanName: 'Downloaded image',
}; };
export const downloadImageError = { export const downloadImageError: LogType = {
eventName: 'Image download error', eventName: 'Image download error',
humanName: 'Failed to download image', humanName: 'Failed to download image',
}; };
export const installService = { export const installService: LogType = {
eventName: 'Service install', eventName: 'Service install',
humanName: 'Installing service', humanName: 'Installing service',
}; };
export const installServiceSuccess = { export const installServiceSuccess: LogType = {
eventName: 'Service installed', eventName: 'Service installed',
humanName: 'Installed service', humanName: 'Installed service',
}; };
export const installServiceError = { export const installServiceError: LogType = {
eventName: 'Service install error', eventName: 'Service install error',
humanName: 'Failed to install service', humanName: 'Failed to install service',
}; };
export const deleteImage = { export const deleteImage: LogType = {
eventName: 'Image removal', eventName: 'Image removal',
humanName: 'Deleting image', humanName: 'Deleting image',
}; };
export const deleteImageSuccess = { export const deleteImageSuccess: LogType = {
eventName: 'Image removed', eventName: 'Image removed',
humanName: 'Deleted image', humanName: 'Deleted image',
}; };
export const deleteImageError = { export const deleteImageError: LogType = {
eventName: 'Image removal error', eventName: 'Image removal error',
humanName: 'Failed to delete image', humanName: 'Failed to delete image',
}; };
export const imageAlreadyDeleted = { export const imageAlreadyDeleted: LogType = {
eventName: 'Image already deleted', eventName: 'Image already deleted',
humanName: 'Image already deleted', humanName: 'Image already deleted',
}; };
export const deltaStillProcessingError = { export const deltaStillProcessingError: LogType = {
eventName: 'Delta still processing remotely.', eventName: 'Delta still processing remotely.',
humanName: 'Delta still processing remotely. Will retry...', humanName: 'Delta still processing remotely. Will retry...',
}; };
export const startService = { export const startService: LogType = {
eventName: 'Service start', eventName: 'Service start',
humanName: 'Starting service', humanName: 'Starting service',
}; };
export const startServiceSuccess = { export const startServiceSuccess: LogType = {
eventName: 'Service started', eventName: 'Service started',
humanName: 'Started service', humanName: 'Started service',
}; };
export const startServiceNoop = { export const startServiceNoop: LogType = {
eventName: 'Service already running', eventName: 'Service already running',
humanName: 'Service is already running', humanName: 'Service is already running',
}; };
export const startServiceError = { export const startServiceError: LogType = {
eventName: 'Service start error', eventName: 'Service start error',
humanName: 'Failed to start service', humanName: 'Failed to start service',
}; };
export const updateService = { export const updateService: LogType = {
eventName: 'Service update', eventName: 'Service update',
humanName: 'Updating service', humanName: 'Updating service',
}; };
export const updateServiceError = { export const updateServiceError: LogType = {
eventName: 'Service update error', eventName: 'Service update error',
humanName: 'Failed to update service', humanName: 'Failed to update service',
}; };
export const serviceExit = { export const serviceExit: LogType = {
eventName: 'Service exit', eventName: 'Service exit',
humanName: 'Service exited', humanName: 'Service exited',
}; };
export const serviceRestart = { export const serviceRestart: LogType = {
eventName: 'Service restart', eventName: 'Service restart',
humanName: 'Restarting service', humanName: 'Restarting service',
}; };
export const updateServiceConfig = { export const updateServiceConfig: LogType = {
eventName: 'Service config update', eventName: 'Service config update',
humanName: 'Updating config for service', humanName: 'Updating config for service',
}; };
export const updateServiceConfigSuccess = { export const updateServiceConfigSuccess: LogType = {
eventName: 'Service config updated', eventName: 'Service config updated',
humanName: 'Updated config for service', humanName: 'Updated config for service',
}; };
export const updateServiceConfigError = { export const updateServiceConfigError: LogType = {
eventName: 'Service config update error', eventName: 'Service config update error',
humanName: 'Failed to update config for service', humanName: 'Failed to update config for service',
}; };
export const createVolume = { export const createVolume: LogType = {
eventName: 'Volume creation', eventName: 'Volume creation',
humanName: 'Creating volume', humanName: 'Creating volume',
}; };
export const createVolumeError = { export const createVolumeError: LogType = {
eventName: 'Volume creation error', eventName: 'Volume creation error',
humanName: 'Error creating volume', humanName: 'Error creating volume',
}; };
export const removeVolume = { export const removeVolume: LogType = {
eventName: 'Volume removal', eventName: 'Volume removal',
humanName: 'Removing volume', humanName: 'Removing volume',
}; };
export const removeVolumeError = { export const removeVolumeError: LogType = {
eventName: 'Volume removal error', eventName: 'Volume removal error',
humanName: 'Error removing volume', humanName: 'Error removing volume',
}; };
export const createNetwork = { export const createNetwork: LogType = {
eventName: 'Network creation', eventName: 'Network creation',
humanName: 'Creating network', humanName: 'Creating network',
}; };
export const createNetworkError = { export const createNetworkError: LogType = {
eventName: 'Network creation error', eventName: 'Network creation error',
humanName: 'Error creating network', humanName: 'Error creating network',
}; };
export const removeNetwork = { export const removeNetwork: LogType = {
eventName: 'Network removal', eventName: 'Network removal',
humanName: 'Removing network', humanName: 'Removing network',
}; };
export const removeNetworkError = { export const removeNetworkError: LogType = {
eventName: 'Network removal error', eventName: 'Network removal error',
humanName: 'Error removing network', humanName: 'Error removing network',
}; };