snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Code scanning - action / CodeQL-Build (push) Failing after 2s
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Code scanning - action / CodeQL-Build (push) Failing after 2s
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
This commit is contained in:
37
packages/logger/CHANGELOG.md
Normal file
37
packages/logger/CHANGELOG.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# @rocket.chat/logger
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ([#38989](https://github.com/RocketChat/Rocket.Chat/pull/38989)) chore(eslint): Upgrades ESLint and its configuration
|
||||
|
||||
## 1.0.1-rc.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ([#38989](https://github.com/RocketChat/Rocket.Chat/pull/38989)) chore(eslint): Upgrades ESLint and its configuration
|
||||
|
||||
## 1.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- ([#37114](https://github.com/RocketChat/Rocket.Chat/pull/37114)) Removes stdout logging functionality, related components and settings
|
||||
|
||||
## 1.0.0-rc.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- ([#37114](https://github.com/RocketChat/Rocket.Chat/pull/37114)) Removes stdout logging functionality, related components and settings
|
||||
|
||||
## 0.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ([#31138](https://github.com/RocketChat/Rocket.Chat/pull/31138)) feat(uikit): Move `@rocket.chat/ui-kit` package to the main monorepo
|
||||
|
||||
## 0.0.2-rc.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- b223cbde14: feat(uikit): Move `@rocket.chat/ui-kit` package to the main monorepo
|
||||
27
packages/logger/package.json
Normal file
27
packages/logger/package.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@rocket.chat/logger",
|
||||
"version": "1.0.1",
|
||||
"private": true,
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"/dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsc -p tsconfig.json",
|
||||
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint --fix ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@rocket.chat/emitter": "workspace:~",
|
||||
"pino": "10.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "~9.39.5",
|
||||
"typescript": "~5.9.3"
|
||||
},
|
||||
"volta": {
|
||||
"extends": "../../package.json"
|
||||
}
|
||||
}
|
||||
36
packages/logger/src/getPino.ts
Normal file
36
packages/logger/src/getPino.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { pino, type ChildLoggerOptions } from 'pino';
|
||||
|
||||
const infoLevel = process.env.LESS_INFO_LOGS ? 20 : 35;
|
||||
|
||||
const mainPino = pino({
|
||||
customLevels: {
|
||||
http: infoLevel,
|
||||
method: infoLevel,
|
||||
subscription: infoLevel,
|
||||
startup: 51,
|
||||
},
|
||||
level: 'warn',
|
||||
timestamp: pino.stdTimeFunctions.isoTime,
|
||||
...(process.env.NODE_ENV !== 'production'
|
||||
? {
|
||||
transport: {
|
||||
target: 'pino-pretty',
|
||||
options: {
|
||||
colorize: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
|
||||
export type MainLogger = typeof mainPino;
|
||||
|
||||
export type LoggerOptions = Pick<ChildLoggerOptions<keyof MainLogger['customLevels']>, 'level' | 'redact'>;
|
||||
|
||||
const defaultOptions: LoggerOptions = {
|
||||
level: 'warn',
|
||||
};
|
||||
|
||||
export function getPino(name: string, options: LoggerOptions = {}): MainLogger {
|
||||
return mainPino.child({ name }, { ...defaultOptions, ...options });
|
||||
}
|
||||
91
packages/logger/src/index.ts
Normal file
91
packages/logger/src/index.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { getPino, type LoggerOptions, type MainLogger } from './getPino';
|
||||
import type { LogLevelSetting } from './logLevel';
|
||||
import { logLevel } from './logLevel';
|
||||
|
||||
export * from './getPino';
|
||||
export * from './logLevel';
|
||||
|
||||
const getLevel = (level: LogLevelSetting): string => {
|
||||
switch (level) {
|
||||
case '0':
|
||||
return 'warn';
|
||||
case '1':
|
||||
return 'info';
|
||||
case '2':
|
||||
return 'debug';
|
||||
default:
|
||||
return 'warn';
|
||||
}
|
||||
};
|
||||
|
||||
let defaultLevel = 'warn';
|
||||
|
||||
logLevel.once('changed', (level: LogLevelSetting) => {
|
||||
defaultLevel = getLevel(level);
|
||||
});
|
||||
|
||||
export class Logger {
|
||||
readonly logger: MainLogger;
|
||||
|
||||
constructor(loggerLabel: string, options: LoggerOptions = {}) {
|
||||
this.logger = getPino(loggerLabel, { level: defaultLevel, ...options });
|
||||
|
||||
logLevel.on('changed', (level: LogLevelSetting) => {
|
||||
this.logger.level = getLevel(level);
|
||||
});
|
||||
}
|
||||
|
||||
section(name: string, options: LoggerOptions = {}): MainLogger {
|
||||
const child = this.logger.child({ section: name }, { ...options });
|
||||
|
||||
logLevel.on('changed', (level: LogLevelSetting) => {
|
||||
child.level = getLevel(level);
|
||||
});
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
level(newLevel: string): void {
|
||||
this.logger.level = newLevel;
|
||||
}
|
||||
|
||||
log(msg: object | string): void {
|
||||
this.logger.info(msg);
|
||||
}
|
||||
|
||||
debug(msg: object | string): void {
|
||||
this.logger.debug(msg);
|
||||
}
|
||||
|
||||
info(msg: object | string): void {
|
||||
this.logger.info(msg);
|
||||
}
|
||||
|
||||
startup(msg: object | string): void {
|
||||
this.logger.startup(msg);
|
||||
}
|
||||
|
||||
success(msg: object | string): void {
|
||||
this.logger.info(msg);
|
||||
}
|
||||
|
||||
warn(msg: object | string): void {
|
||||
this.logger.warn(msg);
|
||||
}
|
||||
|
||||
error(msg: object | string): void {
|
||||
this.logger.error(msg);
|
||||
}
|
||||
|
||||
method(msg: object | string): void {
|
||||
this.logger.method(msg);
|
||||
}
|
||||
|
||||
subscription(msg: object | string): void {
|
||||
this.logger.subscription(msg);
|
||||
}
|
||||
|
||||
fatal(err: unknown, ...args: any[]): void {
|
||||
this.logger.fatal(err, ...args);
|
||||
}
|
||||
}
|
||||
7
packages/logger/src/logLevel.ts
Normal file
7
packages/logger/src/logLevel.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { Emitter } from '@rocket.chat/emitter';
|
||||
|
||||
export type LogLevelSetting = '0' | '1' | '2';
|
||||
|
||||
export const logLevel = new Emitter<{
|
||||
changed: LogLevelSetting;
|
||||
}>();
|
||||
9
packages/logger/tsconfig.json
Normal file
9
packages/logger/tsconfig.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "@rocket.chat/tsconfig/server.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist"
|
||||
},
|
||||
"include": ["./src/**/*"]
|
||||
}
|
||||
Reference in New Issue
Block a user