npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@viovnl/cloudlogger

v1.0.17

Published

CloudLogger enables you to perform logging operations easily and quickly in your JavaScript and TypeScript projects. This package facilitates logging operations by sending requests to CloudLogger service running on the server side.

Downloads

26

Readme

CloudLogger

CloudLogger enables you to perform logging operations easily and quickly in your JavaScript and TypeScript projects. This package facilitates logging operations by sending requests to CloudLogger service running on the server side.

Installation

Package managers

You can add the package to your project using npm or yarn package managers:

npm install @viovnl/cloudlogger

or

yarn add @viovnl/cloudlogger

CDN

Or you can include the script in your HTML:

<script src="https://cdn.statically.io/gh/VIOVNL/CloudLogger-NPM/main/dist/index.global.min.js"></script>

Project Secret

To use CloudLogger, you will need a Project secret. Obtain your project secret from CloudLogger Website.

Configuration

CommonJS

// Include the CloudLogger package in your project
const CloudLogger = require('@viovnl/cloudlogger');

// Create an instance of CloudLogger and configure it
const cloudLogger = CloudLogger.Create('your_project_secret');

Vanilla JS

// Create an instance of CloudLogger and configure it
const cloudLogger = CloudLogger.Create("your_project_secret");

React

// Import CloudLogger from the 'cloudlogger' package
import CloudLogger from '@viovnl/cloudlogger';
// Create an instance of CloudLogger and configure it
CloudLogger.Create('your_project_secret');

Methods and Parameters

CloudLogger.Create(projectSecret: string, options?: CloudLoggerOptions)

CloudLogger.Create('your_project_secret', { ThrowExceptionOnFailure: true });

Creates a new instance of CloudLogger with the provided project secret and options.

projectSecret (string)

Your CloudLogger project secret. Obtain your project secret from CloudLogger Website.

options (CloudLoggerOptions)

| Parameter | Type | Default Value | Description | |-------------------------|---------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ThrowExceptionOnFailure | boolean | false | Specifies throwing an exception in case of failure. If ThrowExceptionOnFailure set to true, an exception is thrown when the logging operation fails. If set to false, an error will be written in console. |

CloudLogger.Log(logItems: CloudLoggerItem[], throwExceptionOnFailure?: boolean)

Performs the logging operation.

Example 1

// Perform the logging operation
CloudLogger.Log([
    { Name: "Date", Value: "22-10-1994" },
    { Name: "Country", Value: "Netherlands" },
]);

Example 2

// Prepare the items you want to log
const logItems: CloudLoggerItem[] = [
    { Name: "Date", Value: "22-10-1994" },
    { Name: "Country", Value: "Netherlands" },
];

// Perform the logging operation
CloudLogger.Log(logItems);

Example 3

// Perform the logging operation and throw an exception if it fails, disregarding global ThrowExceptionOnFailure setting.
CloudLogger.Log([
    { Name: "Date", Value: "22-10-1994" },
    { Name: "Country", Value: "Netherlands" },
], true);

Example 4

// Perform the logging operation and don't throw an exception if it fails, disregarding global ThrowExceptionOnFailure setting.
CloudLogger.Log([
    { Name: "Date", Value: "22-10-1994" },
    { Name: "Country", Value: "Netherlands" },
], false);

logItems (CloudLoggerItem[])

| Parameter | Type | Description | |-----------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Name | string | The name of the column in the project where the data will be logged. Ensure that the provided name matches the column name exactly as defined in the project. | | Value | any | The data to be logged into the specified column of the project. It is imperative to ensure that the data logged aligns precisely with the designated data type specified for the column. |

throwExceptionOnFailure (boolean)

| Parameter | Type | Default Value | Description | |-------------------------|---------|--------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | throwExceptionOnFailure | boolean | CloudLoggerOptions.ThrowExceptionOnFailure | Specifies throwing an exception in case of failure. If throwExceptionOnFailure set to true, an exception is thrown when the logging operation fails. If set to false, an error will be written in console. |

CloudLogger.UpdateProjectSecret(projectSecret: string)

Updates the project secret for the CloudLogger instance, enabling logging to a different project.

// Update the project secret
CloudLogger.UpdateProjectSecret("your_project_secret");

Demos

You can check out different demos we have prepared for you under the demo folder.

React + TS

Install the dependencies:

npm install

Run the demo:

npm run dev

React + JS

Install the dependencies:

npm install

Run the demo:

npm run dev

CommonJS

Install the dependencies:

npm install

Run the demo:

node index.js

Vanilla JS

Launch the file in your browser to see the demo in action.