This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package log | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/s3" | |
"sync" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
// init the log writer | |
log.InitRequestLogs() | |
// test logs | |
test() | |
} | |
func test() { | |
// Log with random data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// InitRequestLogs ... | |
func InitRequestLogs() { | |
go func() { | |
for { | |
time.Sleep(time.Second * 5) | |
writeLogs() | |
} | |
}() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// InitRequestLogs ... | |
func InitRequestLogs() { | |
go func() { | |
for { | |
time.Sleep(time.Second * 5) | |
writeLogs() | |
} | |
}() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type requestLogs struct { | |
logs []string | |
sync.Mutex | |
} | |
var reqLogs requestLogs | |
// InitRequestLogs ... | |
func InitRequestLogs() { | |
go func() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type requestLogs struct { | |
logs []string | |
sync.Mutex | |
} | |
var reqLogs requestLogs | |
func LogRequest(url string, reqBody string, respStatus int, resp string) { | |
l := fmt.Sprintf( | |
`{"url": "%s", "reqBody": "%s", "respStatus": "%d", "resp": "%s"\n\r`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type RequestLogs struct { | |
responses []string | |
sync.Mutex | |
} | |
var logs RequestLogs | |
// InitRequestLogs ... | |
func InitRequestLogs() { | |
go func() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SaveRequest with request and response | |
func SaveRequest(url string, reqBody string, respStatus int, resp string) { | |
r := fmt.Sprintf( | |
`{"url": "%s", "reqBody": "%s", "respStatus": "%d", "resp": "%s"\n`, | |
jsonEscape(url), | |
jsonEscape(reqBody), | |
respStatus, | |
jsonEscape(resp), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.*; | |
public class DENEME extends JFrame | |
{ | |
public static final int WIDTH = 300; | |
public static final int HEIGHT = 300; | |
public static JTextField textfield_1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_youtube_cover($url = '') | |
{ | |
$arr = parse_url($url); | |
parse_str($arr['query'],$queries); | |
return 'http://img.youtube.com/vi/'.$queries['v'].'/hqdefault.jpg'; | |
} |
NewerOlder