1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

Strip headers from logs before display, fixes #94

This commit is contained in:
Kevan Ahlquist 2015-02-18 22:56:55 -06:00
parent dd21a4025b
commit 65f7e32f94

View file

@ -20,11 +20,20 @@ function($scope, $routeParams, $location, $anchorScroll, ContainerLogs, Containe
function getLogs() { function getLogs() {
ContainerLogs.get($routeParams.id, {stdout: 1, stderr: 0, timestamps: $scope.showTimestamps}, function(data, status, headers, config) { ContainerLogs.get($routeParams.id, {stdout: 1, stderr: 0, timestamps: $scope.showTimestamps}, function(data, status, headers, config) {
// Replace carriage returns twith newlines to clean up output // Replace carriage returns with newlines to clean up output
$scope.stdout = data.replace(/[\r]/g, '\n'); data = data.replace(/[\r]/g, '\n')
// Strip 8 byte header from each line of output
data = data.substring(8);
data = data.replace(/\n(.{8})/g, '\n');
$scope.stdout = data;
}); });
ContainerLogs.get($routeParams.id, {stdout: 0, stderr: 1, timestamps: $scope.showTimestamps}, function(data, status, headers, config) { ContainerLogs.get($routeParams.id, {stdout: 0, stderr: 1, timestamps: $scope.showTimestamps}, function(data, status, headers, config) {
$scope.stderr = data.replace(/[\r]/g, '\n'); // Replace carriage returns with newlines to clean up output
data = data.replace(/[\r]/g, '\n')
// Strip 8 byte header from each line of output
data = data.substring(8);
data = data.replace(/\n(.{8})/g, '\n');
$scope.stderr = data;
}); });
} }