1.1.2 • Published 6 months ago

@realgolfgames/logging-sdk v1.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

RealGolf.Games Logging SDK

A lightweight logging SDK for sending structured logs to a remote logging endpoint, including IP and geolocation data.

Features

  • Automatically fetches client IP and geolocation
  • Allows custom log endpoint configuration
  • Clean separation of log metadata, details, and location
  • Fully typed for use with TypeScript

Installation

npm install @realgolfgames/logging-sdk

Usage

import createLog from '@realgolfgames/logging-sdk';

const data = await createLog(
  'https://your-custom-endpoint.com/logs', // any endpoint where your api expects logs
  'error', // level: "info" | "error" | "warn"
  'auth', //source
  'Invalid token', // message
  401, // status_code
  'your-costum-domain.com', // origin
  'user_id', // user ID
  'GET', // HTTP method
  '/api/user' // path
);

Parameters

NameTypeDescription
log_endpointstringCustom URL for your log server
level'info' | 'error' | 'warn'The log level
sourcestringThe source module (e.g., 'auth', 'api')
messagestringA descriptive message
status_codenumberHTTP status code
originstringOrigin of the log (e.g., 'frontend')
user_idstringThe ID of the user
methodstringHTTP method (e.g., 'GET', 'POST')
pathstringThe API or route path

Return Type

Promise<
  | { message: string; status: number }
  | { error: string; status: number }
>;

The exact response depends on your logging API implementation.

License

MIT - © 2025 RealGolf.Games UG (haftungsbeschränkt)

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.1

6 months ago

1.0.0

10 months ago

0.0.1

10 months ago