| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { import_process_fail } from "./import_process_fail";
- export class import_log {
- #log;
-
- constructor() {
- this.#log = new Array();
- }
- #append(target) {
- this.#log.push(target);
- }
- #error_dump(error) {
- return (
- "Error: "
- + new String(error) + "."
- );
- }
- #product_dump(product) {
- return (
- "Product: "
- + "barcode: \"" + product.barcode + "\", "
- + "title: \"" + product.title + "\"."
- );
- }
- fail(target) {
- this.#append(
- "Fail when processing item. "
- + this.#product_dump(target.product) + " "
- + this.#error_dump(target.error)
- );
- }
- skip(target) {
- this.#append(
- "Skipping not ready item. "
- + this.#product_dump(target.product) + " "
- + this.#error_dump(target.error)
- );
- }
- get length() {
- return this.#log.length;
- }
- content() {
- return this.#log.join("\n");
- }
- }
|