Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@o3r/logger
Advanced tools
This module provides a bridge to target different loggers (logrocket, fullstory, smartlook) with a common interface. It is reporting the logs emitted by the different Otter Modules.
This package is an Otter Framework Module.
This module provides a bridge to target different logger (logrocket, fullstory, smartlook) with a common interface.
ng add @o3r/logger
[!WARNING] This module requires @o3r/core to be installed.
The LoggerModule
should be imported in the main Module of the application and an instance of a LoggerClient
implementation bound through the forRoot
method.
// in app.module.ts
import {LogRocketClient} from '@o3r/logger/logrocket-logger-client';
// import {SmartLookClient} from '@o3r/logger/smartlook-logger-client';
// import {FullStoryClient} from '@o3r/logger/fullstory-logger-client';
import {LoggerModule} from '@o3r/logger';
// ...
@NgModule({
imports: [
// ...
LoggerModule.forRoot(
new LogRocketClient('LogRocket appId')
// new SmartLookClient('SmartLook key')
// new FullStoryClient('FullStory orgId')
)
]
})
export class AppModule {}
The store can also be bound to the third-party logging service by using the LoggerService.createMetaReducer()
method.
// in app.module.ts
import {Action, MetaReducer, USER_PROVIDED_META_REDUCERS} from '@ngrx/store';
import {LoggerServuce} from '@o3r/logger';
// ...
export function getUserProvidedMetaReducers(logger: LoggerService): MetaReducer<any, Action>[] {
const loggerServiceMetaReducer = logger.createMetaReducer();
return loggerServiceMetaReducer ? [loggerServiceMetaReducer] : [];
}
// ...
@NgModule({
providers: [
// ...
{provide: USER_PROVIDED_META_REDUCERS, deps: [LoggerService], useFactory: getUserProvidedMetaReducers}
]
})
export class AppModule {}
To provide complex logger client, the client can be provided via the LOGGER_CLIENT_TOKEN
as following:
import {LogRocketClient} from '@o3r/logger/logrocket-logger-client';
import {LOGGER_CLIENT_TOKEN, LoggerModule} from '@o3r/logger';
// ...
@NgModule({
imports: [
LoggerModule
],
providers: [
{ provide: LOGGER_CLIENT_TOKEN, useValue: new LogRocketClient('LogRocket appId') }
]
})
export class AppModule {}
The Logger service supports multi logger clients.
This can be provided via the .forRoot()
function of the LoggerModule
as following:
import {LogRocketClient} from '@o3r/logger/logrocket-logger-client';
import {SmartLookClient} from '@o3r/logger/smartlook-logger-client';
import {LoggerModule} from '@o3r/logger';
// ...
@NgModule({
imports: [
// ...
LoggerModule.forRoot(
new LogRocketClient('LogRocket appId'),
new SmartLookClient('SmartLook key')
)
]
})
export class AppModule {}
Or via multi providers:
import {LogRocketClient} from '@o3r/logger/logrocket-logger-client';
import {SmartLookClient} from '@o3r/logger/smartlook-logger-client';
import {LOGGER_CLIENT_TOKEN, LoggerModule} from '@o3r/logger';
@NgModule({
imports: [
LoggerModule
],
providers: [
{ provide: LOGGER_CLIENT_TOKEN, useValue: new LogRocketClient('LogRocket appId'), multi: true },
{ provide: LOGGER_CLIENT_TOKEN, useValue: new SmartLookClient('SmartLook key'), multi: true }
]
})
export class AppModule {}
The LoggerService
is agnostic of the third-party services and offers an abstraction layer for the application.
It exposes a generic method that can be called directly regardless of the client used.
For instance:
// ...
import {LoggerService} from '@o3r/logger';
export class TravelerComponent {
constructor(private loggerService: LoggerService) {}
public ngOnInit() {
this.loggerService.identify(emailAddress, {
name: firstName + ' ' + lastName,
email: emailAddress,
ff: frequentFlyerNumber
});
}
}
Find more information in the documentation.
FAQs
This module provides a bridge to target different loggers (logrocket, fullstory, smartlook) with a common interface. It is reporting the logs emitted by the different Otter Modules.
The npm package @o3r/logger receives a total of 5,748 weekly downloads. As such, @o3r/logger popularity was classified as popular.
We found that @o3r/logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.