How to use the @reactioncommerce/logger.info 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 / node-app / core-services / catalog / utils / publishProductToCatalog.js View on Github external
export default async function publishProductToCatalog(product, context) {
  const { appEvents, collections } = context;
  const { Catalog, Products } = collections;

  const startTime = Date.now();

  // Convert Product schema object to Catalog schema object
  const catalogProduct = await createCatalogProduct(product, context);

  // Check to see if product has variants
  // If not, do not publish the product to the Catalog
  if (!catalogProduct.variants || (catalogProduct.variants && catalogProduct.variants.length === 0)) {
    Logger.info("Cannot publish to catalog: product has no visible variants");
    return false;
  }

  const modifier = {
    $set: {
      product: catalogProduct,
      shopId: catalogProduct.shopId,
      updatedAt: new Date()
    },
    $setOnInsert: {
      _id: Random.id(),
      createdAt: new Date()
    }
  };

  CatalogSchema.validate(modifier, { modifier: true });
github reactioncommerce / reaction / imports / plugins / core / core / server / no-meteor / util / loadSampleData.js View on Github external
await context.mutations.publishProducts({ ...context, isInternalCall: true }, topProductIds);
    }
  }

  // Navigation
  const anyNavigationItems = await NavigationItems.findOne({});
  const anyNavigationTrees = await NavigationTrees.findOne({});

  if (!anyNavigationItems && !anyNavigationTrees) {
    if (Array.isArray(sampleData.navigationItems)) {
      Logger.info("Loading navigation items...");
      await NavigationItems.insertMany(sampleData.navigationItems);
    }

    if (Array.isArray(sampleData.navigationTrees)) {
      Logger.info("Loading navigation trees...");
      await NavigationTrees.insertMany(sampleData.navigationTrees);
    }
  }
}
github reactioncommerce / reaction / imports / plugins / core / core / server / Reaction / core.js View on Github external
loadPackages() {
    const packages = Packages.find().fetch();

    let registryFixtureData;

    if (process.env.REACTION_REGISTRY) {
      // check the environment for the registry fixture data first
      registryFixtureData = process.env.REACTION_REGISTRY;
      Logger.info("Loaded REACTION_REGISTRY environment variable for registry fixture import");
    } else {
      // or attempt to load reaction.json fixture data
      try {
        registryFixtureData = Assets.getText("settings/reaction.json");
        Logger.info("Loaded \"/private/settings/reaction.json\" for registry fixture import");
      } catch (error) {
        Logger.warn("Skipped loading settings from reaction.json.");
        Logger.debug(error, "loadSettings reaction.json not loaded.");
      }
    }

    if (registryFixtureData) {
      const validatedJson = EJSON.parse(registryFixtureData);

      if (!Array.isArray(validatedJson[0])) {
        Logger.warn("Registry fixture data is not an array. Failed to load.");
github reactioncommerce / reaction / imports / plugins / core / core / server / startup / index.js View on Github external
export default function startup() {
  const startTime = Date.now();

  // This env may be set by the launch script, allowing us to time how long Meteor build/startup took.
  if (REACTION_METEOR_APP_COMMAND_START_TIME) {
    const elapsedMs = startTime - Number(REACTION_METEOR_APP_COMMAND_START_TIME);
    Logger.info(`Meteor startup finished: ${elapsedMs}ms (This is incorrect if this is a restart.)`);
  }

  Reaction.whenAppInstanceReady(register);

  CollectionSecurity();
  RateLimiters();

  startNodeApp({
    async onAppInstanceCreated(app) {
      await Reaction.onAppInstanceCreated(app);
    }
  })
    .then(() => {
      const endTime = Date.now();
      Logger.info(`Reaction initialization finished: ${endTime - startTime}ms`);
github reactioncommerce / reaction / src / core / util / mongoConnectWithRetry.js View on Github external
return promiseRetry((retry, number) => {
    if (number > 1) {
      Logger.info(`Retrying connect to MongoDB... (${number - 1} of ${mongoInitialConnectRetries})`);
    } else {
      Logger.info("Connecting to MongoDB...");
    }

    return MongoClient.connect(url, {
      useNewUrlParser: true
      // Uncomment this after this `mongodb` pkg bug is fixed:
      // https://jira.mongodb.org/browse/NODE-2249
      // useUnifiedTopology: true
    }).then((client) => {
      Logger.info(`Connected to MongoDB. Database name: ${client.db().databaseName}`);
      return client;
    }).catch((error) => {
      if (error.name === "MongoNetworkError") {
        retry(error);
      } else {
        throw error;
      }
github reactioncommerce / reaction / imports / plugins / core / core / server / startup / startNodeApp.js View on Github external
WebApp.httpServer.on("listening", () => {
    Logger.info(`GraphQL listening at ${ROOT_URL}${app.apolloServer.graphqlPath}`);
    Logger.info(`GraphQL subscriptions ready at ${ROOT_URL.replace("http", "ws")}${app.apolloServer.subscriptionsPath}`);

    appStartupIsComplete = true;
  });
}
github reactioncommerce / reaction / src / core / ReactionAPI.js View on Github external
.then(() => {
          Logger.info("Reaction API stopped");
          done();
          return null;
        })
        .catch((error) => {
github reactioncommerce / reaction / imports / plugins / included / email-smtp / server / methods / saveSettings.js View on Github external
service: String,
    host: Match.Optional(String),
    port: Match.Optional(Number),
    user: Match.Optional(String),
    password: Match.Optional(String)
  });

  Packages.update({ name: "core", shopId: Reaction.getShopId() }, {
    $set: {
      "settings.mail": settings
    }
  });

  delete settings.password;

  Logger.info(settings, "Email settings updated");

  return true;
}
github reactioncommerce / reaction / imports / plugins / included / csv-connector / server / jobs.js View on Github external
}, (job, callback) => {
    Logger.info(`Processing ${jobId} job`);
    processJobItems();
    const doneMessage = `${jobId} job done`;
    Logger.info(doneMessage);
    job.done(doneMessage, { repeatId: true });
    callback();
  });
github reactioncommerce / reaction / imports / plugins / core / core / server / Reaction / core.js View on Github external
setAppVersion() {
    const { version } = packageJson;
    Logger.info(`Reaction Version: ${version}`);
    Shops.update({}, { $set: { appVersion: version } }, { multi: true });
  },

@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