File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,8 @@ export class LoggerWithoutCallSite {
5151 public constructor ( settings ?: ISettingsParam , parentSettings ?: ISettings ) {
5252 this . _parentOrDefaultSettings = {
5353 type : "pretty" ,
54- instanceName : hostname ( ) ,
54+ instanceName : undefined ,
55+ hostname : parentSettings ?. hostname ?? hostname ( ) ,
5556 name : undefined ,
5657 setCallerAsLoggerName : false ,
5758 requestId : undefined ,
@@ -163,6 +164,9 @@ export class LoggerWithoutCallSite {
163164 this . settings . colorizePrettyLogs ;
164165 }
165166
167+ this . _mySettings . instanceName =
168+ this . _mySettings . instanceName ?? this . _mySettings . hostname ;
169+
166170 this . _mySettings . name =
167171 this . _mySettings . name ??
168172 ( this . _mySettings . setCallerAsLoggerName
@@ -396,7 +400,7 @@ export class LoggerWithoutCallSite {
396400 const logObject : ILogObject = {
397401 instanceName : this . settings . instanceName ,
398402 loggerName : this . settings . name ,
399- hostname : hostname ( ) ,
403+ hostname : this . settings . hostname ,
400404 requestId,
401405 date : new Date ( ) ,
402406 logLevel : logLevel ,
Original file line number Diff line number Diff line change @@ -53,6 +53,9 @@ export interface ISettingsParam {
5353 /** Name of the instance name, default: _host name_ */
5454 instanceName ?: string ;
5555
56+ /** Name of the host, default: _host name_ */
57+ hostname ?: string ;
58+
5659 /** Use the name of the caller type as the name of the logger, default: `false` */
5760 setCallerAsLoggerName ?: boolean ;
5861
@@ -164,6 +167,7 @@ export interface ISettingsParam {
164167export interface ISettings extends ISettingsParam {
165168 type : "json" | "pretty" | "hidden" ;
166169 instanceName ?: string ;
170+ hostname : string ;
167171 setCallerAsLoggerName : boolean ;
168172 name ?: string ;
169173 requestId ?: string | TRequestIdFunction ;
You can’t perform that action at this time.
0 commit comments