Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@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 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.