@rawnodes/logger 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -99,6 +99,8 @@ interface LoggerConfig {
99
99
  cloudwatch?: CloudWatchConfig | CloudWatchConfig[];
100
100
  /** Enable caller info (file:line) in logs. Pass true for defaults or CallerConfig for options */
101
101
  caller?: boolean | CallerConfig;
102
+ /** Hostname to include in all log entries. Defaults to os.hostname() if not specified */
103
+ hostname?: string;
102
104
  }
103
105
  type LoggerContext = Record<string, unknown>;
104
106
  type LevelOverrideMatch<TContext extends LoggerContext> = Partial<TContext> & {
@@ -306,6 +308,7 @@ declare const LoggerConfigSchema: z.ZodObject<{
306
308
  telegram: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>, z.ZodArray<z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>>]>>;
307
309
  cloudwatch: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>, z.ZodArray<z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>>]>>;
308
310
  caller: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<CallerConfig, unknown, z.core.$ZodTypeInternals<CallerConfig, unknown>>]>>;
311
+ hostname: z.ZodOptional<z.ZodString>;
309
312
  }, z.core.$strip>;
310
313
  declare function validateConfig(config: unknown): z.infer<typeof LoggerConfigSchema>;
311
314
  declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
@@ -316,6 +319,7 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
316
319
  telegram?: TelegramConfig | TelegramConfig[] | undefined;
317
320
  cloudwatch?: CloudWatchConfig | CloudWatchConfig[] | undefined;
318
321
  caller?: boolean | CallerConfig | undefined;
322
+ hostname?: string | undefined;
319
323
  }>;
320
324
 
321
325
  export { BaseHttpTransport, type BaseHttpTransportOptions, type BufferOptions, type BufferedMessage, type CallerConfig, CallerConfigSchema, type CallerInfo, type CloudWatchConfig, CloudWatchConfigSchema, CloudWatchTransport, type ConsoleConfig, ConsoleConfigSchema, type DiscordConfig, DiscordConfigSchema, DiscordTransport, type FileConfig, FileConfigSchema, type HttpTransportBaseConfig, HttpTransportBaseConfigSchema, LOG_LEVELS, type LevelConfig, type LevelConfigObject, LevelConfigObjectSchema, LevelConfigSchema, type LevelOverride, type LevelOverrideMatch, type LevelRule, LevelRuleSchema, type LogFormat, LogFormatSchema, type LogLevel, LogLevelSchema, Logger, type LoggerConfig, LoggerConfigSchema, type LoggerContext, LoggerStore, type MaskSecretsOptions, MessageBuffer, type Meta, type RequestIdOptions, type SingletonLogger, type TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, assertLogLevel, createMasker, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, isValidLogLevel, maskSecrets, matchesContext, measureAsync, measureSync, safeValidateConfig, validateConfig };
package/dist/index.d.ts CHANGED
@@ -99,6 +99,8 @@ interface LoggerConfig {
99
99
  cloudwatch?: CloudWatchConfig | CloudWatchConfig[];
100
100
  /** Enable caller info (file:line) in logs. Pass true for defaults or CallerConfig for options */
101
101
  caller?: boolean | CallerConfig;
102
+ /** Hostname to include in all log entries. Defaults to os.hostname() if not specified */
103
+ hostname?: string;
102
104
  }
103
105
  type LoggerContext = Record<string, unknown>;
104
106
  type LevelOverrideMatch<TContext extends LoggerContext> = Partial<TContext> & {
@@ -306,6 +308,7 @@ declare const LoggerConfigSchema: z.ZodObject<{
306
308
  telegram: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>, z.ZodArray<z.ZodType<TelegramConfig, unknown, z.core.$ZodTypeInternals<TelegramConfig, unknown>>>]>>;
307
309
  cloudwatch: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>, z.ZodArray<z.ZodType<CloudWatchConfig, unknown, z.core.$ZodTypeInternals<CloudWatchConfig, unknown>>>]>>;
308
310
  caller: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodType<CallerConfig, unknown, z.core.$ZodTypeInternals<CallerConfig, unknown>>]>>;
311
+ hostname: z.ZodOptional<z.ZodString>;
309
312
  }, z.core.$strip>;
310
313
  declare function validateConfig(config: unknown): z.infer<typeof LoggerConfigSchema>;
311
314
  declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
@@ -316,6 +319,7 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
316
319
  telegram?: TelegramConfig | TelegramConfig[] | undefined;
317
320
  cloudwatch?: CloudWatchConfig | CloudWatchConfig[] | undefined;
318
321
  caller?: boolean | CallerConfig | undefined;
322
+ hostname?: string | undefined;
319
323
  }>;
320
324
 
321
325
  export { BaseHttpTransport, type BaseHttpTransportOptions, type BufferOptions, type BufferedMessage, type CallerConfig, CallerConfigSchema, type CallerInfo, type CloudWatchConfig, CloudWatchConfigSchema, CloudWatchTransport, type ConsoleConfig, ConsoleConfigSchema, type DiscordConfig, DiscordConfigSchema, DiscordTransport, type FileConfig, FileConfigSchema, type HttpTransportBaseConfig, HttpTransportBaseConfigSchema, LOG_LEVELS, type LevelConfig, type LevelConfigObject, LevelConfigObjectSchema, LevelConfigSchema, type LevelOverride, type LevelOverrideMatch, type LevelRule, LevelRuleSchema, type LogFormat, LogFormatSchema, type LogLevel, LogLevelSchema, Logger, type LoggerConfig, LoggerConfigSchema, type LoggerContext, LoggerStore, type MaskSecretsOptions, MessageBuffer, type Meta, type RequestIdOptions, type SingletonLogger, type TelegramConfig, TelegramConfigSchema, TelegramTransport, type TimingResult, assertLogLevel, createMasker, createSingletonLogger, extractRequestId, flattenObject, formatCallerInfo, formatLogfmt, formatLogfmtValue, generateRequestId, getCallerInfo, getOrGenerateRequestId, isValidLogLevel, maskSecrets, matchesContext, measureAsync, measureSync, safeValidateConfig, validateConfig };
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var os = require('os');
3
4
  var pino = require('pino');
4
5
  var async_hooks = require('async_hooks');
5
6
  var stream = require('stream');
@@ -809,8 +810,7 @@ function createState(config, store) {
809
810
  level: "trace",
810
811
  // Accept all, we filter in shouldLog()
811
812
  customLevels: CUSTOM_LEVELS,
812
- base: void 0
813
- // Disable pid and hostname
813
+ base: { hostname: config.hostname ?? os.hostname() }
814
814
  };
815
815
  const pinoLogger = pino__default.default(options, streams);
816
816
  let callerConfig;
@@ -961,7 +961,8 @@ var LoggerConfigSchema = zod.z.object({
961
961
  discord: zod.z.union([DiscordConfigSchema, zod.z.array(DiscordConfigSchema)]).optional(),
962
962
  telegram: zod.z.union([TelegramConfigSchema, zod.z.array(TelegramConfigSchema)]).optional(),
963
963
  cloudwatch: zod.z.union([CloudWatchConfigSchema, zod.z.array(CloudWatchConfigSchema)]).optional(),
964
- caller: zod.z.union([zod.z.boolean(), CallerConfigSchema]).optional()
964
+ caller: zod.z.union([zod.z.boolean(), CallerConfigSchema]).optional(),
965
+ hostname: zod.z.string().optional()
965
966
  });
966
967
  function validateConfig(config) {
967
968
  return LoggerConfigSchema.parse(config);