@@ -38,6 +38,7 @@ type Config struct {
3838 MaxTmpFsInodes uint64 `json:"max_tmpfs_inodes"`
3939 DisableReadOnlyRootFs bool `json:"disable_readonly_rootfs"`
4040 DisableDebugUserLogs bool `json:"disable_debug_user_logs"`
41+ UserLogLevel string `json:"user_log_level"`
4142 IOFSEnableTmpfs bool `json:"iofs_enable_tmpfs"`
4243 IOFSAgentPath string `json:"iofs_path"`
4344 IOFSMountRoot string `json:"iofs_mount_root"`
@@ -69,16 +70,14 @@ const (
6970 EnvHotPoll = "FN_HOT_POLL_MSECS"
7071 // EnvHotLauncherTimeout is the timeout for a hot container queue to persist if idle
7172 EnvHotLauncherTimeout = "FN_HOT_LAUNCHER_TIMEOUT_MSECS"
72- // EnvHotStartTimeout is the timeout for a hot container to be created including docker-pull
73+ // EnvHotPullTimeout is the timeout for a hot container to be created including docker-pull
7374 EnvHotPullTimeout = "FN_HOT_PULL_TIMEOUT_MSECS"
7475 // EnvHotStartTimeout is the timeout for a hot container to become available for use for requests after EnvHotStartTimeout
7576 EnvHotStartTimeout = "FN_HOT_START_TIMEOUT_MSECS"
7677 // EnvMaxResponseSize is the maximum number of bytes that a function may return from an invocation
7778 EnvMaxResponseSize = "FN_MAX_RESPONSE_SIZE"
78- // EnvHdrMaxResponseSize is the maximum number of bytes that a function may return in an invocation header
79+ // EnvMaxHdrResponseSize is the maximum number of bytes that a function may return in an invocation header
7980 EnvMaxHdrResponseSize = "FN_MAX_HDR_RESPONSE_SIZE"
80- // EnvMaxLogSize is the maximum size that a function's log may reach
81- EnvMaxLogSize = "FN_MAX_LOG_SIZE_BYTES"
8281 // EnvMaxTotalCPU is the maximum CPU that will be reserved across all containers
8382 EnvMaxTotalCPU = "FN_MAX_TOTAL_CPU_MCPUS"
8483 // EnvMaxTotalMemory is the maximum memory that will be reserved across all containers
@@ -106,6 +105,8 @@ const (
106105 EnvDisableReadOnlyRootFs = "FN_DISABLE_READONLY_ROOTFS"
107106 // EnvDisableDebugUserLogs disables user function logs being logged at level debug. wise to enable for production.
108107 EnvDisableDebugUserLogs = "FN_DISABLE_DEBUG_USER_LOGS"
108+ // EnvUserLogLevel is the logging level to use for user's function logs to be logged by fn. to disable explicitly, use FN_DISABLE_DEBUG_USER_LOGS
109+ EnvUserLogLevel = "FN_USER_LOG_LEVEL"
109110
110111 // EnvIOFSEnableTmpfs enables creating a per-container tmpfs mount for the IOFS
111112 EnvIOFSEnableTmpfs = "FN_IOFS_TMPFS"
@@ -140,7 +141,6 @@ const (
140141func NewConfig () (* Config , error ) {
141142 cfg := & Config {
142143 MinDockerVersion : "17.10.0-ce" ,
143- MaxLogSize : 1 * 1024 * 1024 ,
144144 PreForkImage : "busybox" ,
145145 PreForkCmd : "tail -f /dev/null" ,
146146 }
@@ -154,7 +154,6 @@ func NewConfig() (*Config, error) {
154154 err = setEnvMsecs (err , EnvDetachedHeadroom , & cfg .DetachedHeadRoom , time .Duration (360 )* time .Second )
155155 err = setEnvUint (err , EnvMaxResponseSize , & cfg .MaxResponseSize )
156156 err = setEnvUint (err , EnvMaxHdrResponseSize , & cfg .MaxHdrResponseSize )
157- err = setEnvUint (err , EnvMaxLogSize , & cfg .MaxLogSize )
158157 err = setEnvUint (err , EnvMaxTotalCPU , & cfg .MaxTotalCPU )
159158 err = setEnvUint (err , EnvMaxTotalMemory , & cfg .MaxTotalMemory )
160159 err = setEnvUint (err , EnvMaxFsSize , & cfg .MaxFsSize )
@@ -176,6 +175,7 @@ func NewConfig() (*Config, error) {
176175 err = setEnvBool (err , EnvEnableNBResourceTracker , & cfg .EnableNBResourceTracker )
177176 err = setEnvBool (err , EnvDisableReadOnlyRootFs , & cfg .DisableReadOnlyRootFs )
178177 err = setEnvBool (err , EnvDisableDebugUserLogs , & cfg .DisableDebugUserLogs )
178+ err = setEnvStr (err , EnvUserLogLevel , & cfg .UserLogLevel )
179179 err = setEnvUint (err , EnvImageCleanMaxSize , & cfg .ImageCleanMaxSize )
180180 err = setEnvStr (err , EnvImageCleanExemptTags , & cfg .ImageCleanExemptTags )
181181 err = setEnvBool (err , EnvImageEnableVolume , & cfg .ImageEnableVolume )
@@ -184,11 +184,6 @@ func NewConfig() (*Config, error) {
184184 return cfg , err
185185 }
186186
187- if cfg .MaxLogSize > math .MaxInt64 {
188- // for safety during uint64 to int conversions in Write()/Read(), etc.
189- return cfg , fmt .Errorf ("error invalid %s %v > %v" , EnvMaxLogSize , cfg .MaxLogSize , math .MaxInt64 )
190- }
191-
192187 return cfg , nil
193188}
194189
0 commit comments