logologo
البدء
الدليل
التطوير
الإضافات
API
English
简体中文
日本語
한국어
Deutsch
Français
Español
Português
Русский
Italiano
Türkçe
Українська
Tiếng Việt
Bahasa Indonesia
ไทย
Polski
Nederlands
Čeština
العربية
עברית
हिन्दी
Svenska
البدء
الدليل
التطوير
الإضافات
API
logologo
API Overview

@nocobase/auth

AuthManager
Auth
BaseAuth

@nocobase/cache

CacheManager
التخزين المؤقت

@nocobase/cli

NocoBase CLI
متغيرات البيئة العامة

@nocobase/client

التطبيق
إضافة

@nocobase/database

مجموعة
الحقل

interfaces

BaseInterface
عوامل التصفية

RelationRepository

BelongsToManyRepository
belongs-to-repository
HasManyRepository
HasOneRepository
المستودع (Repository)

shared

create-options
destroy-options
find-one
transaction
update-options

@nocobase/data-source-manager

DataSourceManager
DataSource (تجريدي)
ICollectionManager
ICollection
IField
IModel
IRepository

@nocobase/flow-engine

مدير مصدر البيانات
سياق سير العمل
FlowEngine
FlowModel
مصدر سير العمل

@nocobase/logger

المسجل

@nocobase/server

AppCommand
التطبيق
AuditManager
السياق
الهجرة
إضافة

@nocobase/sdk

Auth
التخزين

@nocobase/telemetry

المقياس
Telemetry
التتبع
Previous Pageمصدر سير العمل
Next PageAppCommand
إشعار الترجمة بالذكاء الاصطناعي

تمت ترجمة هذه الوثائق تلقائيًا بواسطة الذكاء الاصطناعي.

#المسجل

#إنشاء مسجل

#createLogger()

ينشئ مسجلاً مخصصًا.

#التوقيع

  • createLogger(options: LoggerOptions)

#النوع

interface LoggerOptions
  extends Omit<winston.LoggerOptions, 'transports' | 'format'> {
  dirname?: string;
  filename?: string;
  format?: 'logfmt' | 'json' | 'delimiter' | 'console' | winston.Logform.Format;
  transports?: ('console' | 'file' | 'dailyRotateFile' | winston.transport)[];
}

#التفاصيل

الخاصيةالوصف
dirnameدليل إخراج السجل
filenameاسم ملف السجل
formatتنسيق السجل
transportsطريقة إخراج السجل

#createSystemLogger()

ينشئ سجلات تشغيل النظام التي تُطبع بطريقة محددة. راجع المسجل - سجل النظام

#التوقيع

  • createSystemLogger(options: SystemLoggerOptions)

#النوع

export interface SystemLoggerOptions extends LoggerOptions {
  seperateError?: boolean; // print error seperately, default true
}

#التفاصيل

الخاصيةالوصف
seperateErrorهل يتم إخراج سجلات مستوى error بشكل منفصل؟

#requestLogger()

وسيط (Middleware) لتسجيل طلبات واستجابات الواجهة البرمجية (API).

app.use(requestLogger(app.name));

#التوقيع

  • requestLogger(appName: string, options?: RequestLoggerOptions): MiddewareType

#النوع

export interface RequestLoggerOptions extends LoggerOptions {
  skip?: (ctx?: any) => Promise<boolean>;
  requestWhitelist?: string[];
  responseWhitelist?: string[];
}

#التفاصيل

الخاصيةالنوعالوصفالقيمة الافتراضية
skip(ctx?: any) => Promise<boolean>يتخطى التسجيل لطلبات معينة بناءً على سياق الطلب.-
requestWhiteliststring[]قائمة بيضاء لمعلومات الطلب التي ستُطبع في السجل.[ 'action', 'header.x-role', 'header.x-hostname', 'header.x-timezone', 'header.x-locale','header.x-authenticator', 'header.x-data-source', 'referer']
responseWhiteliststring[]قائمة بيضاء لمعلومات الاستجابة التي ستُطبع في السجل.['status']

#app.createLogger()

#التعريف

class Application {
  createLogger(options: LoggerOptions) {
    const { dirname } = options;
    return createLogger({
      ...options,
      dirname: getLoggerFilePath(this.name || 'main', dirname || ''),
    });
  }
}

عندما يكون dirname مسارًا نسبيًا، ستُخرج ملفات السجل إلى الدليل الذي يحمل اسم التطبيق الحالي.

#plugin.createLogger()

الاستخدام هو نفسه لـ app.createLogger().

#التعريف

class Plugin {
  createLogger(options: LoggerOptions) {
    return this.app.createLogger(options);
  }
}

#إعدادات المسجل

#getLoggerLevel()

getLoggerLevel(): 'debug' | 'info' | 'warn' | 'error'

يحصل على مستوى السجل المُكوّن حاليًا في النظام.

#getLoggerFilePath()

getLoggerFilePath(...paths: string[]): string

يربط مسارات الدلائل بناءً على دليل السجل المُكوّن حاليًا في النظام.

#getLoggerTransports()

getLoggerTransports(): ('console' | 'file' | 'dailyRotateFile')[]

يحصل على طرق إخراج السجل المُكوّنة حاليًا في النظام.

#getLoggerFormat()

getLoggerFormat(): 'logfmt' | 'json' | 'delimiter' | 'console'

يحصل على تنسيق السجل المُكوّن حاليًا في النظام.

#إخراج السجل

#طرق الإخراج (Transports)

طرق الإخراج المحددة مسبقًا.

  • Transports.console
  • Transports.file
  • Transports.dailyRotateFile
import { Transports } from '@nocobase/logger';

const transport = Transports.console({
  //...
});

#الوثائق ذات الصلة

  • دليل التطوير - المسجل
  • المسجل