Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 832
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
From 9b9e601abc06e35ab81bbae6af1536a0fffb0457 Mon Sep 17 00:00:00 2001
From: Pawel
Date: Sat, 31 May 2025 23:22:59 -0700
Subject: [PATCH 1/5] move log to client
---
client.go | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
rollbar.go | 43 +-------------------------------------
2 files changed, 61 insertions(+), 42 deletions(-)
diff --git a/client.go b/client.go
index 8602405..494b39a 100644
--- a/client.go
+++ b/client.go
@@ -80,6 +80,66 @@ func NewSync(token, environment, codeVersion, serverHost, serverRoot string) *Cl
}
}
+// Log reports an item with the given level. This function recognizes arguments with the following types:
+//
+// *http.Request
+// error
+// string
+// map[string]interface{}
+// int
+// context.Context
+//
+// The string and error types are mutually exclusive.
+// If an error is present then a stack trace is captured. If an int is also present then we skip
+// that number of stack frames. If the map is present it is used as extra custom data in the
+// item. If a string is present without an error, then we log a message without a stack
+// trace. If a request is present we extract as much relevant information from it as we can. If
+// a context is present, it is applied to downstream operations.
+func (c *Client) Log(level string, interfaces ...interface{}) {
+ var r *http.Request
+ var err error
+ var skip int
+ skipSet := false
+ var extras map[string]interface{}
+ var msg string
+ ctx := context.TODO()
+ for _, ival := range interfaces {
+ switch val := ival.(type) {
+ case *http.Request:
+ r = val
+ case error:
+ err = val
+ case int:
+ skip = val
+ skipSet = true
+ case string:
+ msg = val
+ case map[string]interface{}:
+ extras = val
+ case context.Context:
+ ctx = val
+ default:
+ rollbarError(c.Transport.(*AsyncTransport).Logger, "Unknown input type: %T", val)
+ }
+ }
+ if !skipSet {
+ skip = 2
+ }
+ if err != nil {
+ if r == nil {
+ c.ErrorWithStackSkipWithExtrasAndContext(ctx, level, err, skip, extras)
+ } else {
+ c.RequestErrorWithStackSkipWithExtrasAndContext(ctx, level, r, err, skip, extras)
+ }
+ } else {
+ if r == nil {
+ c.MessageWithExtrasAndContext(ctx, level, msg, extras)
+ } else {
+ c.RequestMessageWithExtrasAndContext(ctx, level, r, msg, extras)
+ }
+ }
+}
+
// CaptureTelemetryEvent sets the user-specified telemetry event
func (c *Client) CaptureTelemetryEvent(eventType, eventlevel string, eventData map[string]interface{}) {
data := map[string]interface{}{}
diff --git a/rollbar.go b/rollbar.go
index 7df6246..8e47bb6 100644
--- a/rollbar.go
+++ b/rollbar.go
@@ -463,48 +463,7 @@ func Debug(interfaces ...interface{}) {
// trace. If a request is present we extract as much relevant information from it as we can. If
// a context is present, it is applied to downstream operations.
func Log(level string, interfaces ...interface{}) {
- var r *http.Request
- var err error
- var skip int
- skipSet := false
- var extras map[string]interface{}
- var msg string
- ctx := context.TODO()
- for _, ival := range interfaces {
- switch val := ival.(type) {
- case *http.Request:
- r = val
- case error:
- err = val
- case int:
- skip = val
- skipSet = true
- case string:
- msg = val
- case map[string]interface{}:
- extras = val
- case context.Context:
- ctx = val
- default:
- rollbarError(std.Transport.(*AsyncTransport).Logger, "Unknown input type: %T", val)
- }
- }
- if !skipSet {
- skip = 2
- }
- if err != nil {
- if r == nil {
- std.ErrorWithStackSkipWithExtrasAndContext(ctx, level, err, skip, extras)
- } else {
- std.RequestErrorWithStackSkipWithExtrasAndContext(ctx, level, r, err, skip, extras)
- }
- } else {
- if r == nil {
- std.MessageWithExtrasAndContext(ctx, level, msg, extras)
- } else {
- std.RequestMessageWithExtrasAndContext(ctx, level, r, msg, extras)
- }
- }
+ std.Log(level, interfaces...)
}
// -- Error reporting
From 2f2c32fdbe04681c5cff01a28e01b64954f7db5f Mon Sep 17 00:00:00 2001
From: Pawel
Date: Sat, 31 May 2025 23:57:21 -0700
Subject: [PATCH 2/5] adding log level to the client
---
client.go | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/client.go b/client.go
index 494b39a..33f9355 100644
--- a/client.go
+++ b/client.go
@@ -140,6 +140,93 @@ func (c *Client) Log(level string, interfaces ...interface{}) {
}
}
+// -- Reporting
+
+// Critical reports an item with level `critical`. This function recognizes arguments with the following types:
+//
+// *http.Request
+// error
+// string
+// map[string]interface{}
+// int
+//
+// The string and error types are mutually exclusive.
+// If an error is present then a stack trace is captured. If an int is also present then we skip
+// that number of stack frames. If the map is present it is used as extra custom data in the
+// item. If a string is present without an error, then we log a message without a stack
+// trace. If a request is present we extract as much relevant information from it as we can.
+func (c *Client) Critical(interfaces ...interface{}) {
+ c.Log(CRIT, interfaces...)
+}
+
+// Error reports an item with level `error`. This function recognizes arguments with the following types:
+//
+// *http.Request
+// error
+// string
+// map[string]interface{}
+// int
+//
+// The string and error types are mutually exclusive.
+// If an error is present then a stack trace is captured. If an int is also present then we skip
+// that number of stack frames. If the map is present it is used as extra custom data in the
+// item. If a string is present without an error, then we log a message without a stack
+// trace. If a request is present we extract as much relevant information from it as we can.
+func (c *Client) Error(interfaces ...interface{}) {
+ c.Log(ERR, interfaces...)
+}
+
+// Warning reports an item with level `warning`. This function recognizes arguments with the following types:
+//
+// *http.Request
+// error
+// string
+// map[string]interface{}
+// int
+//
+// The string and error types are mutually exclusive.
+// If an error is present then a stack trace is captured. If an int is also present then we skip
+// that number of stack frames. If the map is present it is used as extra custom data in the
+// item. If a string is present without an error, then we log a message without a stack
+// trace. If a request is present we extract as much relevant information from it as we can.
+func (c *Client) Warning(interfaces ...interface{}) {
+ c.Log(WARN, interfaces...)
+}
+
+// Info reports an item with level `info`. This function recognizes arguments with the following types:
+//
+// *http.Request
+// error
+// string
+// map[string]interface{}
+// int
+//
+// The string and error types are mutually exclusive.
+// If an error is present then a stack trace is captured. If an int is also present then we skip
+// that number of stack frames. If the map is present it is used as extra custom data in the
+// item. If a string is present without an error, then we log a message without a stack
+// trace. If a request is present we extract as much relevant information from it as we can.
+func (c *Client) Info(interfaces ...interface{}) {
+ c.Log(INFO, interfaces...)
+}
+
+// Debug reports an item with level `debug`. This function recognizes arguments with the following types:
+//
+// *http.Request
+// error
+// string
+// map[string]interface{}
+// int
+//
+// The string and error types are mutually exclusive.
+// If an error is present then a stack trace is captured. If an int is also present then we skip
+// that number of stack frames. If the map is present it is used as extra custom data in the
+// item. If a string is present without an error, then we log a message without a stack
+// trace. If a request is present we extract as much relevant information from it as we can.
+func (c *Client) Debug(interfaces ...interface{}) {
+ c.Log(DEBUG, interfaces...)
+}
+
// CaptureTelemetryEvent sets the user-specified telemetry event
func (c *Client) CaptureTelemetryEvent(eventType, eventlevel string, eventData map[string]interface{}) {
data := map[string]interface{}{}
From c53d1be8dd0377f3007e1562c8e0550d907734c0 Mon Sep 17 00:00:00 2001
From: Pawel
Date: Sun, 1 Jun 2025 00:13:30 -0700
Subject: [PATCH 3/5] added simple test to verify
---
client_test.go | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/client_test.go b/client_test.go
index e0156a7..8579d42 100644
--- a/client_test.go
+++ b/client_test.go
@@ -72,6 +72,27 @@ func TestLogPanic(t *testing.T) {
client.Close()
}
+func TestLogError(t *testing.T) {
+ client := testClient()
+ client.Error(errors.New("logged error"))
+ if transport, ok := client.Transport.(*TestTransport); ok {
+ if transport.WaitCalled {
+ t.Error("Wait called unexpectedly")
+ }
+ body := transport.Body
+ if body["data"] == nil {
+ t.Error("body should have data")
+ }
+ data := body["data"].(map[string]interface{})
+ dataError := errorFromData(data)
+ if dataError["message"] != "logged error" {
+ t.Error("data should have correct error message")
+ }
+ } else {
+ t.Fail()
+ }
+ client.Close()
+}
func TestWrap(t *testing.T) {
client := testClient()
err := errors.New("bork")
From 928620ed8a26d026c711a44ae8affb331d79eb77 Mon Sep 17 00:00:00 2001
From: Pawel
Date: Wed, 4 Jun 2025 21:52:15 -0700
Subject: [PATCH 4/5] addressed PR review
---
client_test.go | 111 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 111 insertions(+)
diff --git a/client_test.go b/client_test.go
index 8579d42..4a6e4ec 100644
--- a/client_test.go
+++ b/client_test.go
@@ -93,6 +93,117 @@ func TestLogError(t *testing.T) {
}
client.Close()
}
+
+func TestLogCriticalLevel(t *testing.T) {
+ client := testClient()
+ client.Critical(errors.New("logged error"))
+ if transport, ok := client.Transport.(*TestTransport); ok {
+ if transport.WaitCalled {
+ t.Error("Wait called unexpectedly")
+ }
+ body := transport.Body
+ if body["data"] == nil {
+ t.Error("body should have data")
+ }
+ data := body["data"].(map[string]interface{})
+
+ if data["level"] != CRIT {
+ t.Error("data should have correct level")
+ }
+ } else {
+ t.Fail()
+ }
+ client.Close()
+}
+
+func TestLogErrorLevel(t *testing.T) {
+ client := testClient()
+ client.Error(errors.New("logged error"))
+ if transport, ok := client.Transport.(*TestTransport); ok {
+ if transport.WaitCalled {
+ t.Error("Wait called unexpectedly")
+ }
+ body := transport.Body
+ if body["data"] == nil {
+ t.Error("body should have data")
+ }
+ data := body["data"].(map[string]interface{})
+
+ if data["level"] != ERR {
+ t.Error("data should have correct level")
+ }
+ } else {
+ t.Fail()
+ }
+ client.Close()
+}
+
+func TestLogWarningLevel(t *testing.T) {
+ client := testClient()
+ client.Warning(errors.New("logged error"))
+ if transport, ok := client.Transport.(*TestTransport); ok {
+ if transport.WaitCalled {
+ t.Error("Wait called unexpectedly")
+ }
+ body := transport.Body
+ if body["data"] == nil {
+ t.Error("body should have data")
+ }
+ data := body["data"].(map[string]interface{})
+
+ if data["level"] != WARN {
+ t.Error("data should have correct level")
+ }
+ } else {
+ t.Fail()
+ }
+ client.Close()
+}
+
+func TestLogInfoLevel(t *testing.T) {
+ client := testClient()
+ client.Info("some message")
+ if transport, ok := client.Transport.(*TestTransport); ok {
+ if transport.WaitCalled {
+ t.Error("Wait called unexpectedly")
+ }
+ body := transport.Body
+ if body["data"] == nil {
+ t.Error("body should have data")
+ }
+ data := body["data"].(map[string]interface{})
+
+ if data["level"] != INFO {
+ t.Error("data should have correct level")
+ }
+ } else {
+ t.Fail()
+ }
+ client.Close()
+}
+
+func TestLogDebugLevel(t *testing.T) {
+ client := testClient()
+ client.Info("some message")
+ if transport, ok := client.Transport.(*TestTransport); ok {
+ if transport.WaitCalled {
+ t.Error("Wait called unexpectedly")
+ }
+ body := transport.Body
+ if body["data"] == nil {
+ t.Error("body should have data")
+ }
+ data := body["data"].(map[string]interface{})
+
+ if data["level"] != DEBUG {
+ t.Error("data should have correct level")
+ }
+ } else {
+ t.Fail()
+ }
+ client.Close()
+}
+
func TestWrap(t *testing.T) {
client := testClient()
err := errors.New("bork")
From 5fbbe46ccce8fd0e63b774cb93030024e6842eed Mon Sep 17 00:00:00 2001
From: Pawel
Date: Wed, 4 Jun 2025 21:54:32 -0700
Subject: [PATCH 5/5] fix message
---
client_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/client_test.go b/client_test.go
index 4a6e4ec..e8bbf16 100644
--- a/client_test.go
+++ b/client_test.go
@@ -184,7 +184,7 @@ func TestLogInfoLevel(t *testing.T) {
func TestLogDebugLevel(t *testing.T) {
client := testClient()
- client.Info("some message")
+ client.Debug("some message")
if transport, ok := client.Transport.(*TestTransport); ok {
if transport.WaitCalled {
t.Error("Wait called unexpectedly")