slack-logs 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +96 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -60,8 +60,104 @@ const payload = [
60
60
  { title: "Title 3", value: [{ id: 12 }] },
61
61
  ];
62
62
  slack.logBlockMessage("Validation Message!", payload);
63
+
64
+ ```
65
+
66
+ ```
67
+ /*Slack Notification with colored block format*/
68
+
69
+ import { LogLevel, slack } from "slack-logs";
70
+
71
+ const payload = [
72
+ { title: "Title 1", value: "1234" },
73
+ { title: "Title 2", value: 123 },
74
+ { title: "Title 3", value: { id: 12 } },
75
+ { title: "Title 3", value: [{ id: 12 }] },
76
+ ];
77
+ slack.logBlockMessage("Validation Message!", payload);
78
+ // Or
79
+ slack.logBlockMessage("Validation Message!", payload, LogLevel.DEFAULT);
80
+ // Or
81
+ slack.logBlockMessage("Validation Message!", payload, LogLevel.ERROR);
82
+ // Or
83
+ slack.logBlockMessage("Validation Message!", payload, LogLevel.INFO);
84
+ // Or
85
+ slack.logBlockMessage("Validation Message!", payload, LogLevel.SUCCESS);
86
+ // Or
87
+ slack.logBlockMessage("Validation Message!", payload, LogLevel.WARN);
88
+
89
+ ```
90
+
91
+ ## Sample code with output:
92
+
93
+ #### Sample 1:
94
+
95
+ ```
96
+ import { slack } from "slack-logs";.
97
+
98
+ slack.log("Data Log with bold", "Here is *BOLD* message");
99
+ slack.log("Highlight Log", "`Message`");
100
+ slack.log("Emoji :rocket: Log", "Yeah :female-technologist::skin-tone-2:");
101
+ slack.log("Object Log", {id:"123", value:"Lorem Impulse"});
102
+ ```
103
+
104
+ ![Sample Image](https://i.imgur.com/ucAnAiJ.png)
105
+
106
+ #### Sample 2:
107
+
108
+ ```
109
+ import { LogLevel, slack } from "slack-logs";.
110
+
111
+ const payload = [
112
+ { title: "Title 1", value: "1234" },
113
+ { title: "Title 2", value: 123 },
114
+ { title: "Title 3", value: { id: 12 } },
115
+ { title: "Title 4", value: [{ id: 12 }] },
116
+ ];
117
+
118
+ slack.logBlockMessage("Custom Logs!", payload);
119
+ slack.logBlockMessage("Some Information Logs!", payload, LogLevel.INFO);
120
+ slack.logBlockMessage("Critical Alert!", payload, LogLevel.ERROR);
121
+ ```
122
+
123
+ ![Sample Image](https://i.imgur.com/Ohlktzr.png)
124
+
125
+ #### Sample 3:
126
+
127
+ ```
128
+ import { LogLevel, slack } from "slack-logs";.
129
+
130
+ const payload = [
131
+ { title: "Event Name", value: "directMessage" },
132
+ {
133
+ title: "`to_user` Validation",
134
+ value: "Message 'to_user' is required! Current value is null",
135
+ },
136
+ ];
137
+
138
+ slack.logBlockMessage(`Validation failure on "development" server`, payload, LogLevel.WARN);
63
139
  ```
64
140
 
141
+ ![Sample Image](https://i.imgur.com/yncdwGJ.png)
142
+
143
+ #### Sample 3:
144
+
145
+ ```
146
+ import { LogLevel, slack } from "slack-logs";.
147
+
148
+ const title =
149
+ ":rotating_light: Error processing message failure on 'local' server :rotating_light:";
150
+
151
+ const payload = [
152
+ { title: "Event Name", value: "directMessage" },
153
+ { title: "`error`", value: {} },
154
+ ];
155
+
156
+ slack.logBlockMessage(title, payload, LogLevel.ERROR);
157
+ ```
158
+
159
+ ![Sample Image](https://i.imgur.com/XszvEEw.png)
160
+
65
161
  ### Contributing
66
162
 
67
163
  Contributions are welcome! If you have a feature request, bug report, or a pull request, please open an issue or submit a PR on the GitHub repository
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slack-logs",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "slack-logs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.ts",