Browse Source

Add sample config const into yamlutil

zry 3 years ago
parent
commit
3bf5952ddf
1 changed files with 92 additions and 0 deletions
  1. 92 0
      hieda_yamlutil/default_config_sample.go

+ 92 - 0
hieda_yamlutil/default_config_sample.go

@@ -0,0 +1,92 @@
+package hieda_yamlutil
+
+const DefaultConfigSampel = `
+# Enable logger
+enable: true
+# Backends
+backends:
+  local_rotate_file:
+    # Should be one of 'console', 'file', 'alisls'
+    type: "file"
+    # Minimum emit level, should be one of 'DEBUG', 'VERBOSE', 'INFO', 'WARN', 'ERROR', 'PANIC', 'FATAL'
+    level: "VERBOSE"
+    # This field should exist for type 'file'
+    file_config:
+      # The path to log file
+      filename: "log_filename.log"
+      # Use 'true' for using console backend formatter for file backend
+      fvconsole: false
+      # Use 'true' for enable rotate
+      rotate: true
+      # This field should exist for rotate log
+      rotate_config:
+        # The maximum size in megabytes of the log file before it gets rotated
+        maxsize: 2
+        # The maximum number of days to retain old log files based on the timestamp encoded in their filename.
+        # Note that a day is defined as 24 hours and may not exactly correspond to calendar days due to daylight
+        # savings, leap seconds, etc. '0' for not to remove old log files based on age
+        maxage: 30
+        # The maximum number of old log files to retain. '0' for retain all old log files
+        # (though MaxAge may still cause them to get deleted.)
+        maxbackups: 24
+        # This determines if the time used for formatting the timestamps in backup files is the computer's local time.
+        # 'false' to use UTC time, 'true' to use local time.
+        localtime: true
+        # This determines if the rotated log files should be compressed using gzip.
+        # 'true' for using gzip, 'false' for not using gzip
+        compress: true
+  sample_backend_alisls:
+    # Should be one of 'console', 'file', 'alisls'
+    type: "alisls"
+    # Minimum emit level, should be one of 'DEBUG', 'VERBOSE', 'INFO', 'WARN', 'ERROR', 'PANIC', 'FATAL'
+    level: "DEBUG"
+    # This field should exist for type 'file'
+    alisls_config:
+      # Use 'true' for enable AliSLS producer debug log.
+      # AliSLS producer will print log to stdout, and we have no way to disable it,
+      # but we can specify the output level. 'true' for level 'debug', 'false' for level 'error'
+      alisls_producer_debug: false
+      # Your Hieda Logger hostname
+      hostname: "<Your Hostname>"
+      # Your Hieda Logger app name
+      appname: "<Your App Name>"
+      # Your AliSLS appkey id
+      ak_id: "<Your SLS Appkey ID>"
+      # Your AliSLS appkey secret
+      ak_secret: "<Your SLS Appkey Secret>"
+      # Your AliSLS endpoint
+      endpoint: "cn-hongkong.log.aliyuncs.com"
+      # Your AliSLS project
+      project: "<Your SLS Project Name>"
+      # Your AliSLS logstore
+      logstore: "<Your SLS Logstore Name>"
+      # Your AliSLS topic
+      topic: "<Your SLS Topic>"
+      # The IP address for AliSLS emit parameter 'source'
+      emit_ip: "0.0.0.0"
+      # Use 'true' to override 'emit_ip' below with your real Internet IP address if possible
+      override_with_real_ip: true
+      # Do not specify this in most situation. Refer to Aliyun SLS documentation.
+#        extend_alisls_config:
+#          total_size_ln_bytes: 104857600
+#          max_io_worker_count: 50
+#          max_block_sec: 60
+#          max_batch_size: 524288
+#          max_batch_count: 4096
+#          linger_ms: 2000
+#          retries: 10
+#          max_reserved_attempts: 11
+#          base_retry_backoff_ms: 100
+#          max_retry_backoff_ms: 50000
+#          adjust_sharg_hash: true
+#          buckets: 64
+#          allow_log_level: ""
+#          log_file_name: ""
+#          is_json_type: false
+#          log_max_size: 0
+#          log_max_backups: 0
+#          log_compress: false
+#          no_retry_status_code_list:
+#            - 400
+#            - 404
+`