nlogger

Last updated:

0 purchases

nlogger Image
nlogger Images
Add to Cart

Description:

nlogger

Nethru Logging SDK is a library that features the implementation of collecting customer behavior information.
Getting started #
To use this library, you must ensure that configure() function is called once the first time the app is run. At this time, you can specify various settings required.
import 'package:nlogger/nlogger.dart';

await NLogger.configure(context, await rootBundle.loadString('assets/nlogger.json'));
copied to clipboard
Then you can send the log by calling event() function whenever you need.
NLogger.event(action: 'example1', context: context);

NLogger.event(
action: 'example2',
params: {
'p1': 'v1',
'p2': 'v2'
},
context: context
);
copied to clipboard
If the user is logged in, you can pass that information to this library as follows.
await NLogger.setUserId('nethru');
copied to clipboard
The information you always want to send together with each log can be delivered as follows.
await NLogger.setSessionAttrs({
'nth_p1': 'v1',
'nth_p2': 'v2'
});
copied to clipboard
Configuration #
The settings that can be passed to configure() function are as follows:



Key
Type
Default
Description




nth_service_id
string

Logging identifier


nth_logging_url_base_http
string

Logging server url


nth_logging_url_base_https
string

Secure logging server url


nth_host
string

Your web application server url


nth_pcid
string

The key name for device identifier


nth_uid
string

The key name for user identifier


nth_cid
string

The key name for custom identifier


nth_request_method
string
GET
HTTP request method (GET or POST)


nth_retry_logging
bool
false
Whether to retry if failure occurs


nth_retry_delay
int
3000
Delay before retry (milliseconds)


nth_queue_size
int
100
Log queue size


nth_session_timeout
int
86400000
Session timeout (milliseconds)



API Reference #
The prototypes of the API functions are as follows.
Future<void> configure(BuildContext context, String json)

void event({
bool https = true,
String? serviceId,
required String action,
Map<String, String>? params,
Map<String, String>? cookies,
BuildContext? context
})

String getDeviceId()
Future<void> setDeviceId(String value)

String getCustomId() {
Future<void> setCustomId(String value)

String getUserId() {
Future<void> setUserId(String value)

Future<void> setSessionAttrs(Map<String, String> attrs)
Map<String, dynamic> getSessionAttrs()
Future<void> clearSessionAttrs()

Future<Map<String, dynamic>> getAllAttrs([BuildContext? context])

void setLogLevel(LogLevel level)
copied to clipboard
Please see the API reference documentation for a full description of this library.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.