
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@amplication/logging-utils
Advanced tools
This library was generated with Nx.
Run nx build util-logging
to build the library.
Run nx test util-logging
to execute the unit tests via Jest.
Libraries should always log without relying on a logger framework. In order to do so, libraries should rely on the ILogger interface and any service/application will pass the proper logger class.
// library.class.ts
import { ILogger } from "@amplication/util/logging";
export class CakeFactory {
constructor(private readonly logger: ILogger){}
printInLog(message: string){
this.logger.info(message)
this.logger.error(message, new Error())
}
}
In your microservices, import the logger module and consume it in your root module.
// module.ts
import { Logger } from '@amplication/util/logging';
const logger = new Logger ({
isProduction: true,
component: "component-name",
logLevel: LogLevel.Warn
})
const logMe = () => {
logger.info("An info log message", { other: { value: 1 }})
// ....
}
The minimum log level can be configured also with the LOG_LEVEL
environment variable, instead of the logLevel: LogLevel.Warn
, to one of the following values:
debug
info
warn
error
A mocked provider can be used in unit tests. The following example explain how to use it
/// myservice.spec.ts
import { MockedLogger } from "@amplication/util/logging/test-utils";
//...
it('', () => {
const target = new Service(MockedLogger);
})
//...
FAQs
This library supplies a logger for Amplication Services
We found that @amplication/logging-utils demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.