Skip to content

Commit

Permalink
Add logLevel config option
Browse files Browse the repository at this point in the history
This new option allows users to set up the level of severity AppSignal
logs.
  • Loading branch information
luismiramirez committed Dec 1, 2021
1 parent 70ead99 commit 158a134
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/nodejs/.changesets/add-loglevel-config-option.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
bump: "patch"
type: "add"
---

Add "logLevel" config option. This new option allows you to select the type of messages
AppSignal's logger will log and up. The "debug" option will log all "debug", "info", "warning"
and "error" log messages. The default value is: "info"

The allowed values are:
- error
- warning
- info
- debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
bump: "patch"
type: "deprecate"
---

Deprecate "debug" and "transactionDebugMode" config options in favor of the new "logLevel"
config option.
4 changes: 4 additions & 0 deletions packages/nodejs/src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe("Configuration", () => {
ignoreErrors: [],
ignoreNamespaces: [],
log: "file",
logLevel: "info",
requestHeaders: [
"accept",
"accept-charset",
Expand Down Expand Up @@ -265,6 +266,7 @@ describe("Configuration", () => {
expect(env("_APPSIGNAL_IGNORE_ERRORS")).toBeUndefined()
expect(env("_APPSIGNAL_IGNORE_NAMESPACES")).toBeUndefined()
expect(env("_APPSIGNAL_LOG")).toEqual("file")
expect(env("_APPSIGNAL_LOG_LEVEL")).toEqual("info")
expect(env("_APPSIGNAL_LOG_FILE_PATH")).toEqual("/tmp/appsignal.log")
expect(env("_APPSIGNAL_PUSH_API_ENDPOINT")).toEqual(
"https://push.appsignal.com"
Expand Down Expand Up @@ -305,6 +307,7 @@ describe("Configuration", () => {
ignoreActions: ["MyAction", "MyOtherAction"],
ignoreErrors: ["MyError", "MyOtherError"],
ignoreNamespaces: ["MyNamespace", "MyOtherNamespace"],
logLevel: "debug",
logPath: "/tmp/other",
runningInContainer: true,
workingDirectoryPath: "/my/path",
Expand Down Expand Up @@ -334,6 +337,7 @@ describe("Configuration", () => {
"MyNamespace,MyOtherNamespace"
)
expect(env("_APPSIGNAL_LOG")).toEqual("file")
expect(env("_APPSIGNAL_LOG_LEVEL")).toEqual("debug")
expect(env("_APPSIGNAL_LOG_FILE_PATH")).toEqual(
path.join("/tmp/other", "appsignal.log")
)
Expand Down
1 change: 1 addition & 0 deletions packages/nodejs/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export class Configuration {
ignoreErrors: [],
ignoreNamespaces: [],
log: "file",
logLevel: "info",
requestHeaders: [
"accept",
"accept-charset",
Expand Down
3 changes: 3 additions & 0 deletions packages/nodejs/src/config/configmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ENV_TO_KEY_MAPPING: { [key: string]: string } = {
APPSIGNAL_IGNORE_ERRORS: "ignoreErrors",
APPSIGNAL_IGNORE_NAMESPACES: "ignoreNamespaces",
APPSIGNAL_LOG: "log",
APPSIGNAL_LOG_LEVEL: "logLevel",
APPSIGNAL_LOG_PATH: "logPath",
APPSIGNAL_PUSH_API_ENDPOINT: "endpoint",
APPSIGNAL_PUSH_API_KEY: "pushApiKey",
Expand Down Expand Up @@ -50,6 +51,7 @@ export const PRIVATE_ENV_MAPPING: { [key: string]: string } = {
_APPSIGNAL_IGNORE_ERRORS: "ignoreErrors",
_APPSIGNAL_IGNORE_NAMESPACES: "ignoreNamespaces",
_APPSIGNAL_LOG: "log",
_APPSIGNAL_LOG_LEVEL: "logLevel",
_APPSIGNAL_PUSH_API_ENDPOINT: "endpoint",
_APPSIGNAL_PUSH_API_KEY: "pushApiKey",
_APPSIGNAL_RUNNING_IN_CONTAINER: "runningInContainer",
Expand Down Expand Up @@ -79,6 +81,7 @@ export const JS_TO_RUBY_MAPPING: { [key: string]: string } = {
ignoreErrors: "ignore_errors",
ignoreNamespaces: "ignore_namespaces",
log: "log",
logLevel: "log_level",
logPath: "log_path",
name: "name",
requestHeaders: "request_headers",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/diagnose
Submodule diagnose updated 1 files
+13 −4 spec/diagnose_spec.rb

0 comments on commit 158a134

Please sign in to comment.