How to use the @reactioncommerce/logger.warn function in @reactioncommerce/logger

To help you get started, we’ve selected a few @reactioncommerce/logger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reactioncommerce / reaction / imports / plugins / included / taxes-taxcloud / server / hooks / hooks.js View on Github external
// this will need some refactoring
      // for multi-vendor/shop orders
      if (shop.addressBook) {
        const shopAddress = shop.addressBook[0];
        origin = {
          Address1: shopAddress.address1,
          City: shopAddress.city,
          State: shopAddress.region,
          Zip5: shopAddress.postal
        };
      }

      // check if plugin is enabled and this calculation method is enabled
      if (pkg && pkg.enabled === true && pkg.settings.taxcloud.enabled === true) {
        if (!apiKey || !apiLoginId) {
          Logger.warn("TaxCloud API Key is required.");
        }
        if (Array.isArray(cartToCalc.shipping) && cartToCalc.shipping.length > 0 && cartToCalc.items) {
          const shippingAddress = cartToCalc.shipping[0].address;

          if (shippingAddress) {
            Logger.debug("TaxCloud triggered on taxes/calculate for cartId:", cartId);
            const url = "https://api.taxcloud.net/1.0/TaxCloud/Lookup";
            const cartItems = [];
            const destination = {
              Address1: shippingAddress.address1,
              City: shippingAddress.city,
              State: shippingAddress.region,
              Zip5: shippingAddress.postal
            };

            // format cart items to TaxCloud structure
github reactioncommerce / reaction / server / methods / core / orders.js View on Github external
carrier,
          address: {
            address: `${shippingAddress.address1}${shippingAddress.address2 ? ` ${shippingAddress.address2}` : ""}`,
            city: shippingAddress.city,
            region: shippingAddress.region,
            postal: shippingAddress.postal
          }
        }
      };

      Logger.debug(`orders/sendNotification status: ${order.workflow.status}`);

      // handle missing root shop email
      if (!shop.emails[0].address) {
        shop.emails[0].address = "no-reply@reactioncommerce.com";
        Logger.warn("No shop email configured. Using no-reply to send mail");
      }

      // anonymous users without emails.
      if (!order.email) {
        const msg = "No order email found. No notification sent.";
        Logger.warn(msg);
        throw new Meteor.Error("email-error", msg);
      }

      // Compile Email with SSR
      let subject;
      let tpl;

      if (action === "shipped") {
        tpl = "orders/shipped";
        subject = "orders/shipped/subject";
github reactioncommerce / reaction / src / core-services / cart / mutations / reconcileCarts.js View on Github external
const carts = await Cart.find({
    $or: [accountCartSelector, anonymousCartSelector]
  }).toArray();

  const anonymousCart = carts.find((cart) => cart._id === anonymousCartId);
  if (!anonymousCart) throw new ReactionError("not-found", "Anonymous cart not found");

  const { shopId } = anonymousCart;

  // In the Meteor app, there are accounts for anonymous users. This check can be removed someday.
  // Don't use `userHasPermission` for this check because that always returns true if there
  // is "owner" role. We want to know explicitly whether they have the "anonymous" role.
  const roles = (user.roles && user.roles[shopId]) || [];
  if (roles.includes("anonymous")) {
    Logger.warn("reconcileCarts called by an anonymous user. Check client code.");
    throw new ReactionError("access-denied", "Access Denied");
  }

  const accountCart = carts.find((cart) => cart.accountId === accountId && cart.shopId === shopId);

  if (accountCart) {
    // We have both carts, so reconcile them according to "mode"
    switch (mode) {
      case "keepAccountCart":
        return {
          cart: await reconcileCartsKeepAccountCart({ accountCart, anonymousCartSelector, Cart })
        };

      case "keepAnonymousCart":
        return {
          cart: await reconcileCartsKeepAnonymousCart({ accountCart, anonymousCart, anonymousCartSelector, context })
github reactioncommerce / reaction / src / core / ReactionAPI.js View on Github external
done();
          return null;
        })
        .catch((error) => {
          Logger.error(error);
          done();
        });
    });

    listenForDeath();

    if (shouldInitReplicaSet) {
      try {
        await initReplicaSet(mongoUrl);
      } catch (error) {
        Logger.warn(`Failed to initialize a MongoDB replica set. This may result in errors or some things not working. Error: ${error.message}`);
      }
    }

    // (1) Connect to MongoDB database
    await this.connectToMongo({ mongoUrl });

    // (2) Init the server here. Some startup may need `app.expressApp`
    this.initServer();

    // (3) Run service startup functions
    await this.runServiceStartup();

    // (4) Start the Express GraphQL server
    await this.startServer({ port });
  }
github reactioncommerce / reaction / imports / plugins / core / core / server / hooks.js View on Github external
MethodHooks.after("shop/createTag", (options) => {
    if (options.error) {
      Logger.warn("Failed to add new tag:", options.error.reason);
      return options.error;
    }
    if (typeof options.result === "string") {
      Logger.debug(`Created tag with _id: ${options.result}`);
    }

    return options.result;
  });
});
github reactioncommerce / reaction / imports / plugins / core / core / server / Reaction / sendVerificationEmail.js View on Github external
github: {
        link: "https://github.com/reactioncommerce/reaction"
      },
      instagram: {
        link: "https://instagram.com/reactioncommerce"
      },
      twitter: {
        link: "https://www.twitter.com/getreaction"
      }
    },
    confirmationUrl: url,
    userEmailAddress: address
  };

  if (!Email.getMailUrl()) {
    Logger.warn(`

  ***************************************************
          IMPORTANT! EMAIL VERIFICATION LINK

           Email sending is not configured.

  Go to the following URL to verify email: ${address}

  ${url}
  ***************************************************

    `);
  }

  const tpl = "accounts/verifyEmail";
  const subject = "accounts/verifyEmail/subject";
github reactioncommerce / reaction / imports / plugins / core / core / server / startup / i18n.js View on Github external
export function loadTranslations(translations) {
  Logger.warn("Calling loadTranslations to load translations is deprecated. " +
    "This function will be removed in the next major release. Pass an 'i18n' object " +
    "with your 'registerPlugin' call instead. Look at any built-in plugin for an example.");
  if (!Array.isArray(translations)) throw new Error("loadTranslations expects first argument to be an array");

  translations.forEach((trns) => {
    if (!Array.isArray(trns)) throw new Error("loadTranslations expects first argument to be an array of arrays");
    trns.forEach(mergeResource);
  });
}
github reactioncommerce / reaction / imports / plugins / core / hydra-oauth / server / oauthEndpoints.js View on Github external
const errorHandler = (errorMessage, res) => {
  Logger.error(`Error while performing Hydra request - ${errorMessage}`);
  if (HYDRA_OAUTH2_ERROR_URL) {
    Logger.error(`Redirecting to HYDRA_OAUTH2_ERROR_URL: ${HYDRA_OAUTH2_ERROR_URL}`);
    res.writeHead(500, { Location: HYDRA_OAUTH2_ERROR_URL });
    return res.end();
  }
  Logger.warn("No HYDRA_OAUTH2_ERROR_URL set in ENV.");
  return res.end();
};
github reactioncommerce / reaction / imports / plugins / core / core / server / startup / i18n.js View on Github external
export function loadTranslations(translations) {
  Logger.warn("Calling loadTranslations to load translations is deprecated. " +
    "This function will be removed in the next major release. Pass an 'i18n' object " +
    "with your 'registerPlugin' call instead. Look at any built-in plugin for an example.");
  if (!Array.isArray(translations)) throw new Error("loadTranslations expects first argument to be an array");

  translations.forEach((trns) => {
    if (!Array.isArray(trns)) throw new Error("loadTranslations expects first argument to be an array of arrays");
    trns.forEach(mergeResource);
  });
}

@reactioncommerce/logger

Reaction application logging based on Bunyan logger

MIT
Latest version published 3 years ago

Package Health Score

36 / 100
Full package analysis

Similar packages