in packages/logger-sls/src/factory/create-logger.ts [72:104]
function sls<I = void>(topic: string, info?: I, {
group = 'LOG',
topicPrefix = factoryTopicPrefix,
sampling = factorySampling,
delay = factoryDelay,
once,
instant
}: ILogOptions = {}): void {
const finalTopic = topicPrefix ? `${topicPrefix}${topic}` : topic;
const onceKey: string | undefined = getOnceKey(finalTopic, once);
if (checkIfIgnore(sampling, onceKey)) {
return;
}
if (onceKey) {
ONCE[onceKey] = 1;
}
const logInfo: ILogInfo = {
__topic__: finalTopic,
GROUP: group,
...getSystemParams(),
...typeof defaultParams === 'function' ? defaultParams() : defaultParams,
...info
};
if (!instant && typeof delay === 'number' && delay > 0) {
setTimeout(() => pipe(finalTopic, logInfo), delay);
} else {
pipe(finalTopic, logInfo, instant);
}
}