logger.d.ts — fastify Source File
Architecture documentation for logger.d.ts, a typescript file in the fastify codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 08af481b_2f35_3710_fb1d_f29fa2ef8473["logger.d.ts"] 531c9fc1_aab6_113a_24da_d449700fa629["./instance"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> 531c9fc1_aab6_113a_24da_d449700fa629 da3dc06e_ef04_319a_fff5_e5211e80e482["./reply"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> da3dc06e_ef04_319a_fff5_e5211e80e482 4285dbb5_245d_95e1_f339_579e1aa1d358["./request"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> 4285dbb5_245d_95e1_f339_579e1aa1d358 6a6fa08e_3d60_0520_25ea_dea35398fc8f["./route"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> 6a6fa08e_3d60_0520_25ea_dea35398fc8f 79072a34_3222_2b87_85da_7f07094af121["./schema"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> 79072a34_3222_2b87_85da_7f07094af121 0ec7ea98_0ca5_a578_7447_eb9a7fa7cc31["./type-provider"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> 0ec7ea98_0ca5_a578_7447_eb9a7fa7cc31 36d8862b_caf4_88a2_ba4d_4f7ed0738291["./utils"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> 36d8862b_caf4_88a2_ba4d_4f7ed0738291 473a42a8_a580_301b_42c4_5215be78511b["error"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> 473a42a8_a580_301b_42c4_5215be78511b db63796d_f2b5_6384_ef40_ca04c921a19e["pino"] 08af481b_2f35_3710_fb1d_f29fa2ef8473 --> db63796d_f2b5_6384_ef40_ca04c921a19e style 08af481b_2f35_3710_fb1d_f29fa2ef8473 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { FastifyError } from '@fastify/error'
import { FastifyInstance } from './instance'
import { FastifyReply } from './reply'
import { FastifyRequest } from './request'
import { RouteGenericInterface } from './route'
import { FastifySchema } from './schema'
import { FastifyTypeProvider, FastifyTypeProviderDefault } from './type-provider'
import { ContextConfigDefault, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase, RawServerDefault } from './utils'
import type {
BaseLogger,
LogFn as FastifyLogFn,
LevelWithSilent as LogLevel,
Bindings,
ChildLoggerOptions,
LoggerOptions as PinoLoggerOptions
} from 'pino'
export type {
FastifyLogFn,
LogLevel,
Bindings,
ChildLoggerOptions,
PinoLoggerOptions
}
export interface FastifyBaseLogger extends Pick<BaseLogger, 'level' | 'info' | 'error' | 'debug' | 'fatal' | 'warn' | 'trace' | 'silent'> {
child(bindings: Bindings, options?: ChildLoggerOptions): FastifyBaseLogger
}
// TODO delete FastifyLoggerInstance in the next major release. It seems that it is enough to have only FastifyBaseLogger.
/**
* @deprecated Use FastifyBaseLogger instead
*/
export type FastifyLoggerInstance = FastifyBaseLogger
export interface FastifyLoggerStreamDestination {
write(msg: string): void;
}
// TODO: once node 18 is EOL, this type can be replaced with plain FastifyReply.
/**
* Specialized reply type used for the `res` log serializer, since only `statusCode` is passed in certain cases.
*/
export type ResSerializerReply<
RawServer extends RawServerBase,
RawReply extends FastifyReply<RouteGenericInterface, RawServer>
> = Partial<RawReply> & Pick<RawReply, 'statusCode'>
/**
* Fastify Custom Logger options.
*/
export interface FastifyLoggerOptions<
RawServer extends RawServerBase = RawServerDefault,
RawRequest extends FastifyRequest<RouteGenericInterface, RawServer, RawRequestDefaultExpression<RawServer>, FastifySchema, FastifyTypeProvider> = FastifyRequest<RouteGenericInterface, RawServer, RawRequestDefaultExpression<RawServer>, FastifySchema, FastifyTypeProviderDefault>,
RawReply extends FastifyReply<RouteGenericInterface, RawServer, RawRequestDefaultExpression<RawServer>, RawReplyDefaultExpression<RawServer>, ContextConfigDefault, FastifySchema, FastifyTypeProvider> = FastifyReply<RouteGenericInterface, RawServer, RawRequestDefaultExpression<RawServer>, RawReplyDefaultExpression<RawServer>, ContextConfigDefault, FastifySchema, FastifyTypeProviderDefault>
> {
serializers?: {
req?: (req: RawRequest) => {
method?: string;
url?: string;
version?: string;
host?: string;
remoteAddress?: string;
remotePort?: number;
[key: string]: unknown;
};
err?: (err: FastifyError) => {
type: string;
message: string;
stack: string;
[key: string]: unknown;
};
res?: (res: ResSerializerReply<RawServer, RawReply>) => {
statusCode?: string | number;
[key: string]: unknown;
};
};
level?: string;
file?: string;
genReqId?: (req: RawRequest) => string;
stream?: FastifyLoggerStreamDestination;
}
export interface FastifyChildLoggerFactory<
RawServer extends RawServerBase = RawServerDefault,
RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>,
Logger extends FastifyBaseLogger = FastifyBaseLogger,
TypeProvider extends FastifyTypeProvider = FastifyTypeProviderDefault
> {
/**
* @param logger The parent logger
* @param bindings The bindings object that will be passed to the child logger
* @param childLoggerOpts The logger options that will be passed to the child logger
* @param rawReq The raw request
* @this The fastify instance
* @returns The child logger instance
*/
(
this: FastifyInstance<RawServer, RawRequest, RawReply, Logger, TypeProvider>,
logger: Logger,
bindings: Bindings,
childLoggerOpts: ChildLoggerOptions,
rawReq: RawRequest
): Logger
}
Domain
Subdomains
Types
Dependencies
- ./instance
- ./reply
- ./request
- ./route
- ./schema
- ./type-provider
- ./utils
- error
- pino
Source
Frequently Asked Questions
What does logger.d.ts do?
logger.d.ts is a source file in the fastify codebase, written in typescript. It belongs to the CoreKernel domain, InstanceFactory subdomain.
What functions are defined in logger.d.ts?
logger.d.ts defines 3 function(s): err, req, res.
What does logger.d.ts depend on?
logger.d.ts imports 9 module(s): ./instance, ./reply, ./request, ./route, ./schema, ./type-provider, ./utils, error, and 1 more.
Where is logger.d.ts in the architecture?
logger.d.ts is located at types/logger.d.ts (domain: CoreKernel, subdomain: InstanceFactory, directory: types).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free