Commit c802dabf authored by Yan Sushchynski (EPAM)'s avatar Yan Sushchynski (EPAM)
Browse files

fix: Anthos logger and Minio

parent 365dea4f
Pipeline #128495 failed with stages
in 12 seconds
......@@ -13,10 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { getLogger } from 'log4js';
import { AbstractLogger, LoggerFactory } from '../../logger';
import { AnthosConfig } from './config';
// fetch logger and export
@LoggerFactory.register('anthos')
......@@ -24,16 +21,17 @@ export class AnthosLogger extends AbstractLogger {
public info(data: any): void {
// tslint:disable-next-line:no-logger
logger.info(data);
console.info(data);
}
public debug(data: any): void {
// tslint:disable-next-line:no-logger
logger.debug(data);
console.debug(data);
}
public error(data: any): void {
logger.error(data);
// tslint:disable-next-line:no-logger
console.error(data);
}
// [TODO] this method should report a metrics using CSP SDK
......@@ -41,9 +39,3 @@ export class AnthosLogger extends AbstractLogger {
return;
}
}
export const logger = getLogger();
export function config() {
logger.level = AnthosConfig.LOGGER_LEVEL;
}
......@@ -185,7 +185,7 @@ export class MinIOStorage extends AbstractStorage {
}
);
const listedObjects = await this.s3.send(listCommand);
if (listedObjects.Contents.length === 0)
if (typeof(listedObjects.Contents) === 'undefined' || listedObjects.Contents.length === 0)
return;
const deleteParams = {
......@@ -263,7 +263,8 @@ export class MinIOStorage extends AbstractStorage {
const listCommand = new ListObjectsCommand(params);
const listedObjects = await this.s3.send(listCommand);
if (listedObjects.Contents.length === 0) return;
if (typeof(listedObjects.Contents) === 'undefined' || listedObjects.Contents.length === 0)
return;
const deleteParams = {
Bucket: this.minioBucket,
......@@ -342,7 +343,7 @@ export class MinIOStorage extends AbstractStorage {
try {
const listCommand = new ListObjectsCommand(params);
const listedObjects = await this.s3.send(listCommand);
if (listedObjects.Contents.length === 0)
if (typeof(listedObjects.Contents) === 'undefined' || listedObjects.Contents.length === 0)
return false;
return true;
} catch (err) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment