oneuptime/log-java
2020-09-08 12:13:12 +01:00
..
.m2 full test deployment 2020-07-16 12:52:14 +01:00
src logger changed to FyipeLogger generally 2020-09-08 12:13:12 +01:00
.gitignore teest and gitignore updated 2020-07-08 20:33:56 +01:00
pom.xml logger changed to FyipeLogger generally 2020-09-08 12:13:12 +01:00
README.md logger changed to FyipeLogger generally 2020-09-08 12:13:12 +01:00

maven

Fyipe Application Logger

A fyipe application logger that can be used to send logs about your applications created on your fypie dashboard

Installation

Maven Install

You can install to use in your project by adding the following to your pom.xml file:

<dependency>
    <groupId>io.hackerbay.fyipe</groupId>
    <artifactId>log-java</artifactId>
    <version>CURRENT_VERSION</version>
</dependency>

Others

Check Maven Central Repository for other modes of installation.

Basic Usage

import com.google.gson.JsonObject;
import io.hackerbay.fyipe.FyipeLogger;

public class SampleClass {

    // constructor
    FyipeLogger logger = new FyipeLogger(
        "API_URL", // https://fyipe.com/api
        "APPLICATION_LOG_ID",
        "APPLICATION_LOG_KEY"
    );

    // Logging a string information
    public void logStringInformation() {
        String content = "Content to be logged";
        JsonObject response = logger.log(content); // returns a JsonObject of response
        System.out.println(response);
    }

    // Logging any object of a class
    public void logACustomClassInformation(CustomClass customClass) {
        String content = new Gson().toJson(customClass); // converts your custom class to a json object
        JsonObject response = logger.log(content); // returns a JsonObject of response
        System.out.println(response);
    }

    // Logging a string with a series of tags
    public void logStringInformation() {
        String content = "Content to be logged";
        String [] tags = { "server", "monitoring", "logs" };
        JsonObject response = logger.log(content, tags); // returns a JsonObject of response
        System.out.println(response);
    }
}

API Documentation

Main API to send logs to the server.

Author: HackerBay, Inc.

new FyipeLogger(apiUrl, applicationId, applicationKey)

Create a constructor from the class, which will be used to send logs to the server.

Kind: Constructor Returns: null

Param Type Description
apiUrl String The Server URL.
applicationId String The Application Log ID.
applicationKey String The Application Log Key.

logger.log(log, tags)

Logs a request of type info to the server.

Kind: method of new FyipeLogger Returns: JsonObject - A response of a success or failure.

Param Type Description
log String The content to the logged on the server.
tags String[] The tag(s) to be attached to the logged item on the server.

logger.warning(warning, tags)

Logs a request of type warning to the server.

Kind: method of new FyipeLogger Returns: JsonObject - A response of a success or failure.

Param Type Description
warning String The content to the logged on the server.
tags String[] The tag(s) to be attached to the logged item on the server.

logger.error(error, tags)

Logs a request of type error to the server.

Kind: method of new FyipeLogger Returns: JsonObject - A response of a success or failure.

Param Type Description
error String The content to the logged on the server.
tags String[] The tag(s) to be attached to the logged item on the server.

Contribution

  • Clone repository
  • run mvn clean install to install dependencies
  • run mvn test to run tests
  • run mvn package to build for production.