Getting started

May 29, 2022

Add to the project

Axios is a required peer dependency. It means that axios is not bundled into logger package, but required to be installed.

As a dependency in a npm project:

npm i --save advanced-logger axios
import { AdvancedLogger, service, strategy } from "advanced-logger"
// or
const { AdvancedLogger, service, strategy } = require("advanced-logger")

As script tags with CDN:

<script src=""></script>
<script src=""></script>
<!--dev version-->
<script src=""></script>
<script src=""></script>


Lets initiate a logger that sends all logs instantly to Sumologic service.

import { AdvancedLogger, service, strategy } from "advanced-logger"

const defaultLogConfig = {
    UserAgent: window.userAgent,
    Channel: "my-company",
    BuildVersion: 123,
    Platform: "browser",
    Severity: "DEBUG",
    Data: "",
    Timestamp: "",
    Message: "",
    Category: "",

const serviceConfig = {
    url: "",
    sourceName: "advancedLoggerTest",
    host: "advanced-logger",
    sourceCategory: "MY/SUMO/namespace",
    method: "POST",

const config = { serviceConfig, defaultLogConfig }

const logger = new AdvancedLogger({
    service: new service.SumologicService(config),
    strategy: new strategy.InstantStrategy(),

logger.log({ test: "instant log u1" }) // sends log message :rocket:
logger.log({ test: "instant log u2" }) // sends log message :rocket:
logger.log({ test: "instant log u3" }) // sends log message :rocket:

Upgrading between breaking changes

2.x to 3.x

  • Install axios to your project or just keep using it if it is already installed
  • Logger is compiled to ES2015 JS target. If your project requires support of old browsers and nodejs, please, make sure that you transpile and add necessary pollyfills to the build