Log information to an external API.

Usage no npm install needed!

<script type="module">
  import antLabLoggerTest from '';


Ant Lab Logger

The Anthroware Laboratory (Ant Lab) Logger is a node framework to log information to a self hosted or Anthroware hosted external API.


  • jest - We use Jest as our primary testing framework
  • axios - For any network calls, Axios is used
  • axios-mock-adapter - Mocking Axios requests when testing
  • flow - Static type checking


1. Installation

Install the library using npm.

npm install --save ant-lab-logger

2. Initialize the SDK

The SDK needs to be initialized. It will also fetch the logging level from the API.

Logger.Init ( apiToken, metaInfo, deviceInfo )

3. Log using the SDK

The SDK exposes the Logger.debug( logInfo, metaInfo, deviceInfo ) method for sending off debug level logs to the webservice.



Log object sent to the API resource.


  • date DateTime of the when the log was created
  • category What grouping of logs this falls under
  • description What happened? For example, the Logout button brought the user to the AreYouSure page
  • jsonOne Field for dumping information. Ordered by priority.
  • jsonTwo Field for dumping information.
  • jsonThree Field for dumping information.
  • jsonFour Field for dumping information.
  • additionalInfo Field for dumping information.
  • userName User who owns the information inside the application

Type information:

Log: {
    date: Date,
    category: string,
    description: string,
    jsonOne: Object,
    jsonTwo: Object,
    jsonThree: Object,
    jsonFour: Object,
    additionalInfo: string,
    username: string,

Device Info

Device specific information. Currently using react-native-device-infofor fetching the information. Implementation may vary depending on how and what information is fetched.


  • Uuid Unique device identifier
  • manufacturer Manufacturer of the device e.g. 'Apple'
  • brand The brand of the device e.g. 'Apple/htc'
  • model The model of the device e.g. 'iPhone 5'
  • deviceId The device's id or for Android the board e.g. 'iPhone 6' or 'goldfish'
  • systemName The operating system name e.g. 'iOS'
  • systemVersion The numbered version of the operating system e.g. '4.4.2'
  • bundleId Namespace of the bundle e.g. 'com.example.mobileapp'
  • buildNumber Version of the application on the phone e.g. ''
  • userAgent Combined information of current OS user.
  • userName User's username
  • locale Locale set in the operating system e.g. en-US
  • timeZone Current time of the user
  • appInEmulator Is the application running inside of an emulator?
  • pinOrFingerprintSet Is the pin or fingerprint set for the user?

Type information:

DeviceInfo: {
    uuid: string,
    manufacturer: string,
    brand: string,
    model: string,
    deviceId: string,
    systemName: string,
    systemVersion: string,
    bundleId: string,
    buildNumber: string,
    userAgent: string,
    locale: string,
    timeZone: string,
    appInEmulator: boolean,
    pinOrFingerprintSet: boolean,


Information about the application, SDK, and current user.


  • apiKey Uuid that authenticates the SDK for every API call
  • sessionId Uuid that lives for the lifetime of the application
  • sdkVersion Version of the SDK itself
  • applicationVersion Version of the application that is consuming the SDK

Type information:

MetaInfo: {
    apiKey: string,
    sessionId: string,
    sdkVersion: string,
    applicationVersion: string,

Example Usage

Ths example imports the logger, initialize with an Api Token and logs a debug log.

import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View } from     'react-native';
import Logger from './log/resource/Logger';

export default class logger extends Component {
  render() {
    var deviceInfo = {
      Uuid: 'sample string 1',
      Manufacturer: 'sample string 2',
      Brand: 'sample string 3',
      Model: 'sample string 4',
      DeviceId: 'sample string 5',
      SystemName: 'sample string 6',
      SystemVersion: 'sample string 7',
      BundleId: 'sample string 8',
      BuildNumber: 'sample string 9',
      UserAgent: 'sample string 10',
      Locale: 'sample string 11',
      TimeZone: 'sample string 12',
      AppInEmulator: true,
      PinOrFingerprintSet: true,
    const metaInfo = {
      apiKey: 'sample string 1',
      sessionId: 'sample string 2',
      sdkVersion: 'sample string 3',
      applicationVersion: 'sample string 6',
    const log = {
      date: new Date(),
      category: 'sample string 1',
      description: 'sample string 2',
      jsonOne: { k: 100 },
      jsonTwo: { k: 100 },
      jsonThree: { k: 100 },
      jsonFour: { k: 100 },
      additionalInfo: 'sample string 3',
      userName: 'sample string 4',
    Logger.init('apitoken', metaInfo, deviceInfo);
    Logger.debug(log, metaInfo, deviceInfo)
      .then(success => {
        console.log('success', success);
      .catch(e => {
        console.log('error', e);
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React   Native!</Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,

AppRegistry.registerComponent('logger', () => logger);