EvanLoggingService

Source logging

Helper to handle BCC log logging reports. The frontend is configured to cache each log that was submitted from everywhere. As a result of this, this service can handle this logs and can create reports for developers for error analysis.


log

loggingService.log(message, level);

Using BCC log function to handle a generalized logging mechanism.

Parameters

  1. message - string: log message
  2. level - string: log level as string, defaults to ‘info’

Returns

Promise returns void: resolved when done

Example

loggingService.log('test', 'error');

getLogsIncludingQueue

loggingService.getLogsIncludingQueue();

Return all logLog including the queue logs

Returns

Array<any>: logs including queue

Example

loggingService.getLogsIncludingQueue();
// => { "timestamp": 1529064180496, "level": "notice", "message": "cool message" }

buildLogObject

loggingService.buildLogObject(logs);

enhance log message with user information

Parameters

  1. logs - Array<any>: logs to use

Returns

Array<any>: log object

Example

loggingService.buildLogObject(loggingService.getLogsIncludingQueue())

getReportLogs

loggingService.getReportLogs(types);

Choose type all for current filtered log. Choose errors for only errors.

Parameters

  1. type - string: all | errors

Returns

Array<any>: specific logs for type

Example

loggingService.getReportLogs([ 'error' ]);

logQuestionAlert

loggingService.logQuestionAlert();

Opens an alert to ask the user to log only errors with on click or with loggin dapp.

Returns

Promise returns any: resolved when clicked

Example

await loggingService.logQuestionAlert();

sendLogs

loggingService.sendLogs(types);

Send log object to loggly.

Parameters

  1. type - string (optional): ‘all’ (send current filtered logs) | ‘errors’ (send only errors)

Example

loggingService.sendLogs('errors')

copy

loggingService.copy(types);

Start copying of the error log. Choose type all for current filtered log. Choose errors for only errors.

Parameters

  1. type - string (optional): ‘all’ (copy current filtered logs) | ‘errors’ (copy only errors)

Returns

Promise returns void: resolved when done

Example

loggingService.copy('errors');