id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
139,000 | spacemonkeygo/spacelog | convenience.go | Tracef | func (l *Logger) Tracef(format string, v ...interface{}) {
if l.getLevel() <= Trace {
l.getHandler().Log(l.name, Trace, fmt.Sprintf(format, v...), 1)
}
} | go | func (l *Logger) Tracef(format string, v ...interface{}) {
if l.getLevel() <= Trace {
l.getHandler().Log(l.name, Trace, fmt.Sprintf(format, v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Tracef",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Trace",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
... | // Tracef logs a format string with values if the logger's level is trace or
// even more permissive. | [
"Tracef",
"logs",
"a",
"format",
"string",
"with",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"trace",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L32-L36 |
139,001 | spacemonkeygo/spacelog | convenience.go | Tracee | func (l *Logger) Tracee(err error) {
if l.getLevel() <= Trace && err != nil {
l.getHandler().Log(l.name, Trace, err.Error(), 1)
}
} | go | func (l *Logger) Tracee(err error) {
if l.getLevel() <= Trace && err != nil {
l.getHandler().Log(l.name, Trace, err.Error(), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Tracee",
"(",
"err",
"error",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Trace",
"&&",
"err",
"!=",
"nil",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Trac... | // Tracee logs an error value if the error is not nil and the logger's level
// is trace or even more permissive. | [
"Tracee",
"logs",
"an",
"error",
"value",
"if",
"the",
"error",
"is",
"not",
"nil",
"and",
"the",
"logger",
"s",
"level",
"is",
"trace",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L40-L44 |
139,002 | spacemonkeygo/spacelog | convenience.go | Debug | func (l *Logger) Debug(v ...interface{}) {
if l.getLevel() <= Debug {
l.getHandler().Log(l.name, Debug, fmt.Sprint(v...), 1)
}
} | go | func (l *Logger) Debug(v ...interface{}) {
if l.getLevel() <= Debug {
l.getHandler().Log(l.name, Debug, fmt.Sprint(v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Debug",
"(",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Debug",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Debug",
",",... | // Debug logs a collection of values if the logger's level is debug or even
// more permissive. | [
"Debug",
"logs",
"a",
"collection",
"of",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"debug",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L54-L58 |
139,003 | spacemonkeygo/spacelog | convenience.go | Debugf | func (l *Logger) Debugf(format string, v ...interface{}) {
if l.getLevel() <= Debug {
l.getHandler().Log(l.name, Debug, fmt.Sprintf(format, v...), 1)
}
} | go | func (l *Logger) Debugf(format string, v ...interface{}) {
if l.getLevel() <= Debug {
l.getHandler().Log(l.name, Debug, fmt.Sprintf(format, v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Debugf",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Debug",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
... | // Debugf logs a format string with values if the logger's level is debug or
// even more permissive. | [
"Debugf",
"logs",
"a",
"format",
"string",
"with",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"debug",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L62-L66 |
139,004 | spacemonkeygo/spacelog | convenience.go | Debuge | func (l *Logger) Debuge(err error) {
if l.getLevel() <= Debug && err != nil {
l.getHandler().Log(l.name, Debug, err.Error(), 1)
}
} | go | func (l *Logger) Debuge(err error) {
if l.getLevel() <= Debug && err != nil {
l.getHandler().Log(l.name, Debug, err.Error(), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Debuge",
"(",
"err",
"error",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Debug",
"&&",
"err",
"!=",
"nil",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Debu... | // Debuge logs an error value if the error is not nil and the logger's level
// is debug or even more permissive. | [
"Debuge",
"logs",
"an",
"error",
"value",
"if",
"the",
"error",
"is",
"not",
"nil",
"and",
"the",
"logger",
"s",
"level",
"is",
"debug",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L70-L74 |
139,005 | spacemonkeygo/spacelog | convenience.go | Info | func (l *Logger) Info(v ...interface{}) {
if l.getLevel() <= Info {
l.getHandler().Log(l.name, Info, fmt.Sprint(v...), 1)
}
} | go | func (l *Logger) Info(v ...interface{}) {
if l.getLevel() <= Info {
l.getHandler().Log(l.name, Info, fmt.Sprint(v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Info",
"(",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Info",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Info",
",",
... | // Info logs a collection of values if the logger's level is info or even
// more permissive. | [
"Info",
"logs",
"a",
"collection",
"of",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"info",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L84-L88 |
139,006 | spacemonkeygo/spacelog | convenience.go | Infof | func (l *Logger) Infof(format string, v ...interface{}) {
if l.getLevel() <= Info {
l.getHandler().Log(l.name, Info, fmt.Sprintf(format, v...), 1)
}
} | go | func (l *Logger) Infof(format string, v ...interface{}) {
if l.getLevel() <= Info {
l.getHandler().Log(l.name, Info, fmt.Sprintf(format, v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Infof",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Info",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"n... | // Infof logs a format string with values if the logger's level is info or
// even more permissive. | [
"Infof",
"logs",
"a",
"format",
"string",
"with",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"info",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L92-L96 |
139,007 | spacemonkeygo/spacelog | convenience.go | Infoe | func (l *Logger) Infoe(err error) {
if l.getLevel() <= Info && err != nil {
l.getHandler().Log(l.name, Info, err.Error(), 1)
}
} | go | func (l *Logger) Infoe(err error) {
if l.getLevel() <= Info && err != nil {
l.getHandler().Log(l.name, Info, err.Error(), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Infoe",
"(",
"err",
"error",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Info",
"&&",
"err",
"!=",
"nil",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Info",... | // Infoe logs an error value if the error is not nil and the logger's level
// is info or even more permissive. | [
"Infoe",
"logs",
"an",
"error",
"value",
"if",
"the",
"error",
"is",
"not",
"nil",
"and",
"the",
"logger",
"s",
"level",
"is",
"info",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L100-L104 |
139,008 | spacemonkeygo/spacelog | convenience.go | Notice | func (l *Logger) Notice(v ...interface{}) {
if l.getLevel() <= Notice {
l.getHandler().Log(l.name, Notice, fmt.Sprint(v...), 1)
}
} | go | func (l *Logger) Notice(v ...interface{}) {
if l.getLevel() <= Notice {
l.getHandler().Log(l.name, Notice, fmt.Sprint(v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Notice",
"(",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Notice",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Notice",
"... | // Notice logs a collection of values if the logger's level is notice or even
// more permissive. | [
"Notice",
"logs",
"a",
"collection",
"of",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"notice",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L114-L118 |
139,009 | spacemonkeygo/spacelog | convenience.go | Noticef | func (l *Logger) Noticef(format string, v ...interface{}) {
if l.getLevel() <= Notice {
l.getHandler().Log(l.name, Notice, fmt.Sprintf(format, v...), 1)
}
} | go | func (l *Logger) Noticef(format string, v ...interface{}) {
if l.getLevel() <= Notice {
l.getHandler().Log(l.name, Notice, fmt.Sprintf(format, v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Noticef",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Notice",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
... | // Noticef logs a format string with values if the logger's level is notice or
// even more permissive. | [
"Noticef",
"logs",
"a",
"format",
"string",
"with",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"notice",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L122-L126 |
139,010 | spacemonkeygo/spacelog | convenience.go | Noticee | func (l *Logger) Noticee(err error) {
if l.getLevel() <= Notice && err != nil {
l.getHandler().Log(l.name, Notice, err.Error(), 1)
}
} | go | func (l *Logger) Noticee(err error) {
if l.getLevel() <= Notice && err != nil {
l.getHandler().Log(l.name, Notice, err.Error(), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Noticee",
"(",
"err",
"error",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Notice",
"&&",
"err",
"!=",
"nil",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"No... | // Noticee logs an error value if the error is not nil and the logger's level
// is notice or even more permissive. | [
"Noticee",
"logs",
"an",
"error",
"value",
"if",
"the",
"error",
"is",
"not",
"nil",
"and",
"the",
"logger",
"s",
"level",
"is",
"notice",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L130-L134 |
139,011 | spacemonkeygo/spacelog | convenience.go | Warn | func (l *Logger) Warn(v ...interface{}) {
if l.getLevel() <= Warning {
l.getHandler().Log(l.name, Warning, fmt.Sprint(v...), 1)
}
} | go | func (l *Logger) Warn(v ...interface{}) {
if l.getLevel() <= Warning {
l.getHandler().Log(l.name, Warning, fmt.Sprint(v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Warn",
"(",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Warning",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Warning",
"... | // Warn logs a collection of values if the logger's level is warning or even
// more permissive. | [
"Warn",
"logs",
"a",
"collection",
"of",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"warning",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L144-L148 |
139,012 | spacemonkeygo/spacelog | convenience.go | Warnf | func (l *Logger) Warnf(format string, v ...interface{}) {
if l.getLevel() <= Warning {
l.getHandler().Log(l.name, Warning, fmt.Sprintf(format, v...), 1)
}
} | go | func (l *Logger) Warnf(format string, v ...interface{}) {
if l.getLevel() <= Warning {
l.getHandler().Log(l.name, Warning, fmt.Sprintf(format, v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Warnf",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Warning",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
... | // Warnf logs a format string with values if the logger's level is warning or
// even more permissive. | [
"Warnf",
"logs",
"a",
"format",
"string",
"with",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"warning",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L152-L156 |
139,013 | spacemonkeygo/spacelog | convenience.go | Warne | func (l *Logger) Warne(err error) {
if l.getLevel() <= Warning && err != nil {
l.getHandler().Log(l.name, Warning, err.Error(), 1)
}
} | go | func (l *Logger) Warne(err error) {
if l.getLevel() <= Warning && err != nil {
l.getHandler().Log(l.name, Warning, err.Error(), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Warne",
"(",
"err",
"error",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Warning",
"&&",
"err",
"!=",
"nil",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"War... | // Warne logs an error value if the error is not nil and the logger's level
// is warning or even more permissive. | [
"Warne",
"logs",
"an",
"error",
"value",
"if",
"the",
"error",
"is",
"not",
"nil",
"and",
"the",
"logger",
"s",
"level",
"is",
"warning",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L160-L164 |
139,014 | spacemonkeygo/spacelog | convenience.go | Error | func (l *Logger) Error(v ...interface{}) {
if l.getLevel() <= Error {
l.getHandler().Log(l.name, Error, fmt.Sprint(v...), 1)
}
} | go | func (l *Logger) Error(v ...interface{}) {
if l.getLevel() <= Error {
l.getHandler().Log(l.name, Error, fmt.Sprint(v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Error",
"(",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Error",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Error",
",",... | // Error logs a collection of values if the logger's level is error or even
// more permissive. | [
"Error",
"logs",
"a",
"collection",
"of",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"error",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L174-L178 |
139,015 | spacemonkeygo/spacelog | convenience.go | Errorf | func (l *Logger) Errorf(format string, v ...interface{}) {
if l.getLevel() <= Error {
l.getHandler().Log(l.name, Error, fmt.Sprintf(format, v...), 1)
}
} | go | func (l *Logger) Errorf(format string, v ...interface{}) {
if l.getLevel() <= Error {
l.getHandler().Log(l.name, Error, fmt.Sprintf(format, v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Errorf",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Error",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
... | // Errorf logs a format string with values if the logger's level is error or
// even more permissive. | [
"Errorf",
"logs",
"a",
"format",
"string",
"with",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"error",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L182-L186 |
139,016 | spacemonkeygo/spacelog | convenience.go | Errore | func (l *Logger) Errore(err error) {
if l.getLevel() <= Error && err != nil {
l.getHandler().Log(l.name, Error, err.Error(), 1)
}
} | go | func (l *Logger) Errore(err error) {
if l.getLevel() <= Error && err != nil {
l.getHandler().Log(l.name, Error, err.Error(), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Errore",
"(",
"err",
"error",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Error",
"&&",
"err",
"!=",
"nil",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Erro... | // Errore logs an error value if the error is not nil and the logger's level
// is error or even more permissive. | [
"Errore",
"logs",
"an",
"error",
"value",
"if",
"the",
"error",
"is",
"not",
"nil",
"and",
"the",
"logger",
"s",
"level",
"is",
"error",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L190-L194 |
139,017 | spacemonkeygo/spacelog | convenience.go | Crit | func (l *Logger) Crit(v ...interface{}) {
if l.getLevel() <= Critical {
l.getHandler().Log(l.name, Critical, fmt.Sprint(v...), 1)
}
} | go | func (l *Logger) Crit(v ...interface{}) {
if l.getLevel() <= Critical {
l.getHandler().Log(l.name, Critical, fmt.Sprint(v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Crit",
"(",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Critical",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Critical",
... | // Crit logs a collection of values if the logger's level is critical or even
// more permissive. | [
"Crit",
"logs",
"a",
"collection",
"of",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"critical",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L204-L208 |
139,018 | spacemonkeygo/spacelog | convenience.go | Critf | func (l *Logger) Critf(format string, v ...interface{}) {
if l.getLevel() <= Critical {
l.getHandler().Log(l.name, Critical, fmt.Sprintf(format, v...), 1)
}
} | go | func (l *Logger) Critf(format string, v ...interface{}) {
if l.getLevel() <= Critical {
l.getHandler().Log(l.name, Critical, fmt.Sprintf(format, v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Critf",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Critical",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
... | // Critf logs a format string with values if the logger's level is critical or
// even more permissive. | [
"Critf",
"logs",
"a",
"format",
"string",
"with",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"critical",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L212-L216 |
139,019 | spacemonkeygo/spacelog | convenience.go | Crite | func (l *Logger) Crite(err error) {
if l.getLevel() <= Critical && err != nil {
l.getHandler().Log(l.name, Critical, err.Error(), 1)
}
} | go | func (l *Logger) Crite(err error) {
if l.getLevel() <= Critical && err != nil {
l.getHandler().Log(l.name, Critical, err.Error(), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Crite",
"(",
"err",
"error",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"Critical",
"&&",
"err",
"!=",
"nil",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"name",
",",
"Cr... | // Crite logs an error value if the error is not nil and the logger's level
// is critical or even more permissive. | [
"Crite",
"logs",
"an",
"error",
"value",
"if",
"the",
"error",
"is",
"not",
"nil",
"and",
"the",
"logger",
"s",
"level",
"is",
"critical",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L220-L224 |
139,020 | spacemonkeygo/spacelog | convenience.go | Log | func (l *Logger) Log(level LogLevel, v ...interface{}) {
if l.getLevel() <= level {
l.getHandler().Log(l.name, level, fmt.Sprint(v...), 1)
}
} | go | func (l *Logger) Log(level LogLevel, v ...interface{}) {
if l.getLevel() <= level {
l.getHandler().Log(l.name, level, fmt.Sprint(v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Log",
"(",
"level",
"LogLevel",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"level",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
".",
"n... | // Log logs a collection of values if the logger's level is the provided level
// or even more permissive. | [
"Log",
"logs",
"a",
"collection",
"of",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"the",
"provided",
"level",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L234-L238 |
139,021 | spacemonkeygo/spacelog | convenience.go | Logf | func (l *Logger) Logf(level LogLevel, format string, v ...interface{}) {
if l.getLevel() <= level {
l.getHandler().Log(l.name, level, fmt.Sprintf(format, v...), 1)
}
} | go | func (l *Logger) Logf(level LogLevel, format string, v ...interface{}) {
if l.getLevel() <= level {
l.getHandler().Log(l.name, level, fmt.Sprintf(format, v...), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Logf",
"(",
"level",
"LogLevel",
",",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"level",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
... | // Logf logs a format string with values if the logger's level is the provided
// level or even more permissive. | [
"Logf",
"logs",
"a",
"format",
"string",
"with",
"values",
"if",
"the",
"logger",
"s",
"level",
"is",
"the",
"provided",
"level",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L242-L246 |
139,022 | spacemonkeygo/spacelog | convenience.go | Loge | func (l *Logger) Loge(level LogLevel, err error) {
if l.getLevel() <= level && err != nil {
l.getHandler().Log(l.name, level, err.Error(), 1)
}
} | go | func (l *Logger) Loge(level LogLevel, err error) {
if l.getLevel() <= level && err != nil {
l.getHandler().Log(l.name, level, err.Error(), 1)
}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Loge",
"(",
"level",
"LogLevel",
",",
"err",
"error",
")",
"{",
"if",
"l",
".",
"getLevel",
"(",
")",
"<=",
"level",
"&&",
"err",
"!=",
"nil",
"{",
"l",
".",
"getHandler",
"(",
")",
".",
"Log",
"(",
"l",
... | // Loge logs an error value if the error is not nil and the logger's level
// is the provided level or even more permissive. | [
"Loge",
"logs",
"an",
"error",
"value",
"if",
"the",
"error",
"is",
"not",
"nil",
"and",
"the",
"logger",
"s",
"level",
"is",
"the",
"provided",
"level",
"or",
"even",
"more",
"permissive",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L250-L254 |
139,023 | spacemonkeygo/spacelog | convenience.go | Writer | func (l *Logger) Writer(level LogLevel) io.Writer {
return &writer{l: l, level: level}
} | go | func (l *Logger) Writer(level LogLevel) io.Writer {
return &writer{l: l, level: level}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Writer",
"(",
"level",
"LogLevel",
")",
"io",
".",
"Writer",
"{",
"return",
"&",
"writer",
"{",
"l",
":",
"l",
",",
"level",
":",
"level",
"}",
"\n",
"}"
] | // Writer returns an io.Writer that writes messages at the given log level. | [
"Writer",
"returns",
"an",
"io",
".",
"Writer",
"that",
"writes",
"messages",
"at",
"the",
"given",
"log",
"level",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L275-L277 |
139,024 | spacemonkeygo/spacelog | convenience.go | WriterWithoutCaller | func (l *Logger) WriterWithoutCaller(level LogLevel) io.Writer {
return &writerNoCaller{l: l, level: level}
} | go | func (l *Logger) WriterWithoutCaller(level LogLevel) io.Writer {
return &writerNoCaller{l: l, level: level}
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"WriterWithoutCaller",
"(",
"level",
"LogLevel",
")",
"io",
".",
"Writer",
"{",
"return",
"&",
"writerNoCaller",
"{",
"l",
":",
"l",
",",
"level",
":",
"level",
"}",
"\n",
"}"
] | // WriterWithoutCaller returns an io.Writer that writes messages at the given
// log level, but does not attempt to collect the Write caller, and provides
// no caller information to the log event. | [
"WriterWithoutCaller",
"returns",
"an",
"io",
".",
"Writer",
"that",
"writes",
"messages",
"at",
"the",
"given",
"log",
"level",
"but",
"does",
"not",
"attempt",
"to",
"collect",
"the",
"Write",
"caller",
"and",
"provides",
"no",
"caller",
"information",
"to",... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/convenience.go#L294-L296 |
139,025 | spacemonkeygo/spacelog | collection.go | NewLoggerCollection | func NewLoggerCollection() *LoggerCollection {
return &LoggerCollection{
loggers: make(map[string]*Logger),
level: DefaultLevel,
handler: defaultHandler}
} | go | func NewLoggerCollection() *LoggerCollection {
return &LoggerCollection{
loggers: make(map[string]*Logger),
level: DefaultLevel,
handler: defaultHandler}
} | [
"func",
"NewLoggerCollection",
"(",
")",
"*",
"LoggerCollection",
"{",
"return",
"&",
"LoggerCollection",
"{",
"loggers",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"Logger",
")",
",",
"level",
":",
"DefaultLevel",
",",
"handler",
":",
"defaultHandler... | // NewLoggerCollection creates a new logger collection. It's unlikely you will
// ever practically need this method. Use the DefaultLoggerCollection instead. | [
"NewLoggerCollection",
"creates",
"a",
"new",
"logger",
"collection",
".",
"It",
"s",
"unlikely",
"you",
"will",
"ever",
"practically",
"need",
"this",
"method",
".",
"Use",
"the",
"DefaultLoggerCollection",
"instead",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L61-L66 |
139,026 | spacemonkeygo/spacelog | collection.go | GetLoggerNamed | func (c *LoggerCollection) GetLoggerNamed(name string) *Logger {
c.mtx.Lock()
defer c.mtx.Unlock()
logger, exists := c.loggers[name]
if !exists {
logger = &Logger{level: c.level,
collection: c,
name: name,
handler: c.handler}
c.loggers[name] = logger
}
return logger
} | go | func (c *LoggerCollection) GetLoggerNamed(name string) *Logger {
c.mtx.Lock()
defer c.mtx.Unlock()
logger, exists := c.loggers[name]
if !exists {
logger = &Logger{level: c.level,
collection: c,
name: name,
handler: c.handler}
c.loggers[name] = logger
}
return logger
} | [
"func",
"(",
"c",
"*",
"LoggerCollection",
")",
"GetLoggerNamed",
"(",
"name",
"string",
")",
"*",
"Logger",
"{",
"c",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"logger",
",",
"exists",
":="... | // GetLoggerNamed returns a new Logger with the provided name. GetLogger is
// more frequently used. | [
"GetLoggerNamed",
"returns",
"a",
"new",
"Logger",
"with",
"the",
"provided",
"name",
".",
"GetLogger",
"is",
"more",
"frequently",
"used",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L122-L135 |
139,027 | spacemonkeygo/spacelog | collection.go | SetLevel | func (c *LoggerCollection) SetLevel(re *regexp.Regexp, level LogLevel) {
c.mtx.Lock()
defer c.mtx.Unlock()
if re == nil {
c.level = level
}
for name, logger := range c.loggers {
if re == nil || re.MatchString(name) {
logger.setLevel(level)
}
}
} | go | func (c *LoggerCollection) SetLevel(re *regexp.Regexp, level LogLevel) {
c.mtx.Lock()
defer c.mtx.Unlock()
if re == nil {
c.level = level
}
for name, logger := range c.loggers {
if re == nil || re.MatchString(name) {
logger.setLevel(level)
}
}
} | [
"func",
"(",
"c",
"*",
"LoggerCollection",
")",
"SetLevel",
"(",
"re",
"*",
"regexp",
".",
"Regexp",
",",
"level",
"LogLevel",
")",
"{",
"c",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"if"... | // SetLevel will set the current log level for all loggers with names that
// match a provided regular expression. If the regular expression is nil, then
// all loggers match. | [
"SetLevel",
"will",
"set",
"the",
"current",
"log",
"level",
"for",
"all",
"loggers",
"with",
"names",
"that",
"match",
"a",
"provided",
"regular",
"expression",
".",
"If",
"the",
"regular",
"expression",
"is",
"nil",
"then",
"all",
"loggers",
"match",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L140-L152 |
139,028 | spacemonkeygo/spacelog | collection.go | SetHandler | func (c *LoggerCollection) SetHandler(re *regexp.Regexp, handler Handler) {
c.mtx.Lock()
defer c.mtx.Unlock()
if re == nil {
c.handler = handler
}
for name, logger := range c.loggers {
if re == nil || re.MatchString(name) {
logger.setHandler(handler)
}
}
} | go | func (c *LoggerCollection) SetHandler(re *regexp.Regexp, handler Handler) {
c.mtx.Lock()
defer c.mtx.Unlock()
if re == nil {
c.handler = handler
}
for name, logger := range c.loggers {
if re == nil || re.MatchString(name) {
logger.setHandler(handler)
}
}
} | [
"func",
"(",
"c",
"*",
"LoggerCollection",
")",
"SetHandler",
"(",
"re",
"*",
"regexp",
".",
"Regexp",
",",
"handler",
"Handler",
")",
"{",
"c",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"... | // SetHandler will set the current log handler for all loggers with names that
// match a provided regular expression. If the regular expression is nil, then
// all loggers match. | [
"SetHandler",
"will",
"set",
"the",
"current",
"log",
"handler",
"for",
"all",
"loggers",
"with",
"names",
"that",
"match",
"a",
"provided",
"regular",
"expression",
".",
"If",
"the",
"regular",
"expression",
"is",
"nil",
"then",
"all",
"loggers",
"match",
"... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L157-L169 |
139,029 | spacemonkeygo/spacelog | collection.go | SetTextTemplate | func (c *LoggerCollection) SetTextTemplate(re *regexp.Regexp,
t *template.Template) {
c.mtx.Lock()
defer c.mtx.Unlock()
if re == nil {
c.handler.SetTextTemplate(t)
}
for name, logger := range c.loggers {
if re == nil || re.MatchString(name) {
logger.getHandler().SetTextTemplate(t)
}
}
} | go | func (c *LoggerCollection) SetTextTemplate(re *regexp.Regexp,
t *template.Template) {
c.mtx.Lock()
defer c.mtx.Unlock()
if re == nil {
c.handler.SetTextTemplate(t)
}
for name, logger := range c.loggers {
if re == nil || re.MatchString(name) {
logger.getHandler().SetTextTemplate(t)
}
}
} | [
"func",
"(",
"c",
"*",
"LoggerCollection",
")",
"SetTextTemplate",
"(",
"re",
"*",
"regexp",
".",
"Regexp",
",",
"t",
"*",
"template",
".",
"Template",
")",
"{",
"c",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mtx",
".",
"Unlock",... | // SetTextTemplate will set the current text template for all loggers with
// names that match a provided regular expression. If the regular expression
// is nil, then all loggers match. Note that not every handler is guaranteed
// to support text templates and a text template will only apply to
// text-oriented and un... | [
"SetTextTemplate",
"will",
"set",
"the",
"current",
"text",
"template",
"for",
"all",
"loggers",
"with",
"names",
"that",
"match",
"a",
"provided",
"regular",
"expression",
".",
"If",
"the",
"regular",
"expression",
"is",
"nil",
"then",
"all",
"loggers",
"matc... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L176-L189 |
139,030 | spacemonkeygo/spacelog | collection.go | SetTextOutput | func (c *LoggerCollection) SetTextOutput(re *regexp.Regexp,
output TextOutput) {
c.mtx.Lock()
defer c.mtx.Unlock()
if re == nil {
c.handler.SetTextOutput(output)
}
for name, logger := range c.loggers {
if re == nil || re.MatchString(name) {
logger.getHandler().SetTextOutput(output)
}
}
} | go | func (c *LoggerCollection) SetTextOutput(re *regexp.Regexp,
output TextOutput) {
c.mtx.Lock()
defer c.mtx.Unlock()
if re == nil {
c.handler.SetTextOutput(output)
}
for name, logger := range c.loggers {
if re == nil || re.MatchString(name) {
logger.getHandler().SetTextOutput(output)
}
}
} | [
"func",
"(",
"c",
"*",
"LoggerCollection",
")",
"SetTextOutput",
"(",
"re",
"*",
"regexp",
".",
"Regexp",
",",
"output",
"TextOutput",
")",
"{",
"c",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n"... | // SetTextOutput will set the current output interface for all loggers with
// names that match a provided regular expression. If the regular expression
// is nil, then all loggers match. Note that not every handler is guaranteed
// to support text output and a text output interface will only apply to
// text-oriented ... | [
"SetTextOutput",
"will",
"set",
"the",
"current",
"output",
"interface",
"for",
"all",
"loggers",
"with",
"names",
"that",
"match",
"a",
"provided",
"regular",
"expression",
".",
"If",
"the",
"regular",
"expression",
"is",
"nil",
"then",
"all",
"loggers",
"mat... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L196-L209 |
139,031 | spacemonkeygo/spacelog | collection.go | SetLevel | func SetLevel(re *regexp.Regexp, level LogLevel) {
DefaultLoggerCollection.SetLevel(re, level)
} | go | func SetLevel(re *regexp.Regexp, level LogLevel) {
DefaultLoggerCollection.SetLevel(re, level)
} | [
"func",
"SetLevel",
"(",
"re",
"*",
"regexp",
".",
"Regexp",
",",
"level",
"LogLevel",
")",
"{",
"DefaultLoggerCollection",
".",
"SetLevel",
"(",
"re",
",",
"level",
")",
"\n",
"}"
] | // SetLevel will set the current log level for all loggers on the default
// collection with names that match a provided regular expression. If the
// regular expression is nil, then all loggers match. | [
"SetLevel",
"will",
"set",
"the",
"current",
"log",
"level",
"for",
"all",
"loggers",
"on",
"the",
"default",
"collection",
"with",
"names",
"that",
"match",
"a",
"provided",
"regular",
"expression",
".",
"If",
"the",
"regular",
"expression",
"is",
"nil",
"t... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L244-L246 |
139,032 | spacemonkeygo/spacelog | collection.go | SetHandler | func SetHandler(re *regexp.Regexp, handler Handler) {
DefaultLoggerCollection.SetHandler(re, handler)
} | go | func SetHandler(re *regexp.Regexp, handler Handler) {
DefaultLoggerCollection.SetHandler(re, handler)
} | [
"func",
"SetHandler",
"(",
"re",
"*",
"regexp",
".",
"Regexp",
",",
"handler",
"Handler",
")",
"{",
"DefaultLoggerCollection",
".",
"SetHandler",
"(",
"re",
",",
"handler",
")",
"\n",
"}"
] | // SetHandler will set the current log handler for all loggers on the default
// collection with names that match a provided regular expression. If the
// regular expression is nil, then all loggers match. | [
"SetHandler",
"will",
"set",
"the",
"current",
"log",
"handler",
"for",
"all",
"loggers",
"on",
"the",
"default",
"collection",
"with",
"names",
"that",
"match",
"a",
"provided",
"regular",
"expression",
".",
"If",
"the",
"regular",
"expression",
"is",
"nil",
... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L251-L253 |
139,033 | spacemonkeygo/spacelog | collection.go | SetTextTemplate | func SetTextTemplate(re *regexp.Regexp, t *template.Template) {
DefaultLoggerCollection.SetTextTemplate(re, t)
} | go | func SetTextTemplate(re *regexp.Regexp, t *template.Template) {
DefaultLoggerCollection.SetTextTemplate(re, t)
} | [
"func",
"SetTextTemplate",
"(",
"re",
"*",
"regexp",
".",
"Regexp",
",",
"t",
"*",
"template",
".",
"Template",
")",
"{",
"DefaultLoggerCollection",
".",
"SetTextTemplate",
"(",
"re",
",",
"t",
")",
"\n",
"}"
] | // SetTextTemplate will set the current text template for all loggers on the
// default collection with names that match a provided regular expression. If
// the regular expression is nil, then all loggers match. Note that not every
// handler is guaranteed to support text templates and a text template will
// only app... | [
"SetTextTemplate",
"will",
"set",
"the",
"current",
"text",
"template",
"for",
"all",
"loggers",
"on",
"the",
"default",
"collection",
"with",
"names",
"that",
"match",
"a",
"provided",
"regular",
"expression",
".",
"If",
"the",
"regular",
"expression",
"is",
... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L260-L262 |
139,034 | spacemonkeygo/spacelog | collection.go | SetTextOutput | func SetTextOutput(re *regexp.Regexp, output TextOutput) {
DefaultLoggerCollection.SetTextOutput(re, output)
} | go | func SetTextOutput(re *regexp.Regexp, output TextOutput) {
DefaultLoggerCollection.SetTextOutput(re, output)
} | [
"func",
"SetTextOutput",
"(",
"re",
"*",
"regexp",
".",
"Regexp",
",",
"output",
"TextOutput",
")",
"{",
"DefaultLoggerCollection",
".",
"SetTextOutput",
"(",
"re",
",",
"output",
")",
"\n",
"}"
] | // SetTextOutput will set the current output interface for all loggers on the
// default collection with names that match a provided regular expression. If
// the regular expression is nil, then all loggers match. Note that not every
// handler is guaranteed to support text output and a text output interface
// will on... | [
"SetTextOutput",
"will",
"set",
"the",
"current",
"output",
"interface",
"for",
"all",
"loggers",
"on",
"the",
"default",
"collection",
"with",
"names",
"that",
"match",
"a",
"provided",
"regular",
"expression",
".",
"If",
"the",
"regular",
"expression",
"is",
... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/collection.go#L269-L271 |
139,035 | spacemonkeygo/spacelog | logger.go | Scope | func (l *Logger) Scope(name string) *Logger {
return l.collection.getLogger(l.name+"."+name, l.getLevel(),
l.getHandler())
} | go | func (l *Logger) Scope(name string) *Logger {
return l.collection.getLogger(l.name+"."+name, l.getLevel(),
l.getHandler())
} | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Scope",
"(",
"name",
"string",
")",
"*",
"Logger",
"{",
"return",
"l",
".",
"collection",
".",
"getLogger",
"(",
"l",
".",
"name",
"+",
"\"",
"\"",
"+",
"name",
",",
"l",
".",
"getLevel",
"(",
")",
",",
"l... | // Scope returns a new Logger with the same level and handler, using the
// receiver Logger's name as a prefix. | [
"Scope",
"returns",
"a",
"new",
"Logger",
"with",
"the",
"same",
"level",
"and",
"handler",
"using",
"the",
"receiver",
"Logger",
"s",
"name",
"as",
"a",
"prefix",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/logger.go#L38-L41 |
139,036 | spacemonkeygo/spacelog | capture_other.go | CaptureOutputToFd | func CaptureOutputToFd(fd int) error {
err := syscall.Dup2(fd, syscall.Stdout)
if err != nil {
return err
}
err = syscall.Dup2(fd, syscall.Stderr)
if err != nil {
return err
}
return nil
} | go | func CaptureOutputToFd(fd int) error {
err := syscall.Dup2(fd, syscall.Stdout)
if err != nil {
return err
}
err = syscall.Dup2(fd, syscall.Stderr)
if err != nil {
return err
}
return nil
} | [
"func",
"CaptureOutputToFd",
"(",
"fd",
"int",
")",
"error",
"{",
"err",
":=",
"syscall",
".",
"Dup2",
"(",
"fd",
",",
"syscall",
".",
"Stdout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"syscall",
".",... | // CaptureOutputToFd redirects the current process' stdout and stderr file
// descriptors to the given file descriptor, using the dup2 syscall. | [
"CaptureOutputToFd",
"redirects",
"the",
"current",
"process",
"stdout",
"and",
"stderr",
"file",
"descriptors",
"to",
"the",
"given",
"file",
"descriptor",
"using",
"the",
"dup2",
"syscall",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/capture_other.go#L28-L38 |
139,037 | spacemonkeygo/spacelog | output.go | NewBufferedOutput | func NewBufferedOutput(output TextOutput, buffer int) *BufferedOutput {
if buffer < 0 {
buffer = 0
}
b := &BufferedOutput{
o: output,
c: make(chan bufferMsg, buffer)}
go b.process()
return b
} | go | func NewBufferedOutput(output TextOutput, buffer int) *BufferedOutput {
if buffer < 0 {
buffer = 0
}
b := &BufferedOutput{
o: output,
c: make(chan bufferMsg, buffer)}
go b.process()
return b
} | [
"func",
"NewBufferedOutput",
"(",
"output",
"TextOutput",
",",
"buffer",
"int",
")",
"*",
"BufferedOutput",
"{",
"if",
"buffer",
"<",
"0",
"{",
"buffer",
"=",
"0",
"\n",
"}",
"\n",
"b",
":=",
"&",
"BufferedOutput",
"{",
"o",
":",
"output",
",",
"c",
... | // NewBufferedOutput returns a BufferedOutput wrapping output with a buffer
// size of buffer. | [
"NewBufferedOutput",
"returns",
"a",
"BufferedOutput",
"wrapping",
"output",
"with",
"a",
"buffer",
"size",
"of",
"buffer",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/output.go#L70-L79 |
139,038 | spacemonkeygo/spacelog | output.go | Close | func (b *BufferedOutput) Close() {
b.close_once.Do(func() {
close(b.c)
})
b.running.Lock()
b.running.Unlock()
} | go | func (b *BufferedOutput) Close() {
b.close_once.Do(func() {
close(b.c)
})
b.running.Lock()
b.running.Unlock()
} | [
"func",
"(",
"b",
"*",
"BufferedOutput",
")",
"Close",
"(",
")",
"{",
"b",
".",
"close_once",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"close",
"(",
"b",
".",
"c",
")",
"\n",
"}",
")",
"\n",
"b",
".",
"running",
".",
"Lock",
"(",
")",
"\n",
"... | // Close shuts down the BufferedOutput's processing | [
"Close",
"shuts",
"down",
"the",
"BufferedOutput",
"s",
"processing"
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/output.go#L82-L88 |
139,039 | spacemonkeygo/spacelog | output.go | NewFileWriterOutput | func NewFileWriterOutput(path string) (*FileWriterOutput, error) {
fo := &FileWriterOutput{path: path}
fh, err := fo.openFile()
if err != nil {
return nil, err
}
fo.WriterOutput = NewWriterOutput(fh)
return fo, nil
} | go | func NewFileWriterOutput(path string) (*FileWriterOutput, error) {
fo := &FileWriterOutput{path: path}
fh, err := fo.openFile()
if err != nil {
return nil, err
}
fo.WriterOutput = NewWriterOutput(fh)
return fo, nil
} | [
"func",
"NewFileWriterOutput",
"(",
"path",
"string",
")",
"(",
"*",
"FileWriterOutput",
",",
"error",
")",
"{",
"fo",
":=",
"&",
"FileWriterOutput",
"{",
"path",
":",
"path",
"}",
"\n",
"fh",
",",
"err",
":=",
"fo",
".",
"openFile",
"(",
")",
"\n",
... | // Creates a new FileWriterOutput object. This is the only case where an
// error opening the file will be reported to the caller; if we try to
// reopen it later and the reopen fails, we'll just keep trying until it
// works. | [
"Creates",
"a",
"new",
"FileWriterOutput",
"object",
".",
"This",
"is",
"the",
"only",
"case",
"where",
"an",
"error",
"opening",
"the",
"file",
"will",
"be",
"reported",
"to",
"the",
"caller",
";",
"if",
"we",
"try",
"to",
"reopen",
"it",
"later",
"and"... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/output.go#L125-L133 |
139,040 | spacemonkeygo/spacelog | output.go | openFile | func (fo *FileWriterOutput) openFile() (*os.File, error) {
return os.OpenFile(fo.path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
} | go | func (fo *FileWriterOutput) openFile() (*os.File, error) {
return os.OpenFile(fo.path, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
} | [
"func",
"(",
"fo",
"*",
"FileWriterOutput",
")",
"openFile",
"(",
")",
"(",
"*",
"os",
".",
"File",
",",
"error",
")",
"{",
"return",
"os",
".",
"OpenFile",
"(",
"fo",
".",
"path",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREATE",
"|",
"os"... | // Try to open the file with the path associated with this object. | [
"Try",
"to",
"open",
"the",
"file",
"with",
"the",
"path",
"associated",
"with",
"this",
"object",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/output.go#L136-L138 |
139,041 | spacemonkeygo/spacelog | output.go | Output | func (fo *FileWriterOutput) Output(ll LogLevel, message []byte) {
if fo.WriterOutput == nil {
fh, err := fo.openFile()
if err != nil {
fo.fallbackLog("Could not open %#v: %s", fo.path, err)
return
}
fo.WriterOutput = NewWriterOutput(fh)
}
fo.WriterOutput.Output(ll, message)
} | go | func (fo *FileWriterOutput) Output(ll LogLevel, message []byte) {
if fo.WriterOutput == nil {
fh, err := fo.openFile()
if err != nil {
fo.fallbackLog("Could not open %#v: %s", fo.path, err)
return
}
fo.WriterOutput = NewWriterOutput(fh)
}
fo.WriterOutput.Output(ll, message)
} | [
"func",
"(",
"fo",
"*",
"FileWriterOutput",
")",
"Output",
"(",
"ll",
"LogLevel",
",",
"message",
"[",
"]",
"byte",
")",
"{",
"if",
"fo",
".",
"WriterOutput",
"==",
"nil",
"{",
"fh",
",",
"err",
":=",
"fo",
".",
"openFile",
"(",
")",
"\n",
"if",
... | // Output a log line by writing it to the file. If the file has been
// released, try to open it again. If that fails, cry for a little
// while, then throw away the message and carry on. | [
"Output",
"a",
"log",
"line",
"by",
"writing",
"it",
"to",
"the",
"file",
".",
"If",
"the",
"file",
"has",
"been",
"released",
"try",
"to",
"open",
"it",
"again",
".",
"If",
"that",
"fails",
"cry",
"for",
"a",
"little",
"while",
"then",
"throw",
"awa... | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/output.go#L151-L161 |
139,042 | spacemonkeygo/spacelog | syslog.go | NewSyslogOutput | func NewSyslogOutput(facility SyslogPriority, tag string) (
TextOutput, error) {
w, err := syslog.New(syslog.Priority(facility), tag)
if err != nil {
return nil, err
}
return &SyslogOutput{w: w}, nil
} | go | func NewSyslogOutput(facility SyslogPriority, tag string) (
TextOutput, error) {
w, err := syslog.New(syslog.Priority(facility), tag)
if err != nil {
return nil, err
}
return &SyslogOutput{w: w}, nil
} | [
"func",
"NewSyslogOutput",
"(",
"facility",
"SyslogPriority",
",",
"tag",
"string",
")",
"(",
"TextOutput",
",",
"error",
")",
"{",
"w",
",",
"err",
":=",
"syslog",
".",
"New",
"(",
"syslog",
".",
"Priority",
"(",
"facility",
")",
",",
"tag",
")",
"\n"... | // NewSyslogOutput returns a TextOutput object that writes to syslog using
// the given facility and tag. The log level will be determined by the log
// event. | [
"NewSyslogOutput",
"returns",
"a",
"TextOutput",
"object",
"that",
"writes",
"to",
"syslog",
"using",
"the",
"given",
"facility",
"and",
"tag",
".",
"The",
"log",
"level",
"will",
"be",
"determined",
"by",
"the",
"log",
"event",
"."
] | 2296661a0572a51438413369004fa931c2641923 | https://github.com/spacemonkeygo/spacelog/blob/2296661a0572a51438413369004fa931c2641923/syslog.go#L34-L41 |
139,043 | andygrunwald/go-trending | trending.go | NewTrendingWithClient | func NewTrendingWithClient(client *http.Client) *Trending {
baseURL, _ := url.Parse(defaultBaseURL)
t := Trending{
BaseURL: baseURL,
Client: client,
}
return &t
} | go | func NewTrendingWithClient(client *http.Client) *Trending {
baseURL, _ := url.Parse(defaultBaseURL)
t := Trending{
BaseURL: baseURL,
Client: client,
}
return &t
} | [
"func",
"NewTrendingWithClient",
"(",
"client",
"*",
"http",
".",
"Client",
")",
"*",
"Trending",
"{",
"baseURL",
",",
"_",
":=",
"url",
".",
"Parse",
"(",
"defaultBaseURL",
")",
"\n",
"t",
":=",
"Trending",
"{",
"BaseURL",
":",
"baseURL",
",",
"Client",... | // NewTrendingWithClient allows providing a custom http.Client to use for fetching trending items.
// It allows setting timeouts or using 3rd party http.Client implementations, such as Google App Engine
// urlfetch.Client. | [
"NewTrendingWithClient",
"allows",
"providing",
"a",
"custom",
"http",
".",
"Client",
"to",
"use",
"for",
"fetching",
"trending",
"items",
".",
"It",
"allows",
"setting",
"timeouts",
"or",
"using",
"3rd",
"party",
"http",
".",
"Client",
"implementations",
"such"... | 5a4d422f8977c920038cdd9523a0c5e711053387 | https://github.com/andygrunwald/go-trending/blob/5a4d422f8977c920038cdd9523a0c5e711053387/trending.go#L148-L155 |
139,044 | andygrunwald/go-trending | trending.go | generateLanguages | func (t *Trending) generateLanguages(mainSelector string) ([]Language, error) {
var languages []Language
// Generate the URL to call
u, err := t.generateURL(modeLanguages, "", "")
if err != nil {
return languages, err
}
// Get document
res, err := t.Client.Get(u.String())
if err != nil {
return languages,... | go | func (t *Trending) generateLanguages(mainSelector string) ([]Language, error) {
var languages []Language
// Generate the URL to call
u, err := t.generateURL(modeLanguages, "", "")
if err != nil {
return languages, err
}
// Get document
res, err := t.Client.Get(u.String())
if err != nil {
return languages,... | [
"func",
"(",
"t",
"*",
"Trending",
")",
"generateLanguages",
"(",
"mainSelector",
"string",
")",
"(",
"[",
"]",
"Language",
",",
"error",
")",
"{",
"var",
"languages",
"[",
"]",
"Language",
"\n\n",
"// Generate the URL to call",
"u",
",",
"err",
":=",
"t",... | // generateLanguages will retrieve the languages out of the github document.
// Trending languages are shown on the right side as a small list.
// Other languages are hidden in a dropdown at this site | [
"generateLanguages",
"will",
"retrieve",
"the",
"languages",
"out",
"of",
"the",
"github",
"document",
".",
"Trending",
"languages",
"are",
"shown",
"on",
"the",
"right",
"side",
"as",
"a",
"small",
"list",
".",
"Other",
"languages",
"are",
"hidden",
"in",
"... | 5a4d422f8977c920038cdd9523a0c5e711053387 | https://github.com/andygrunwald/go-trending/blob/5a4d422f8977c920038cdd9523a0c5e711053387/trending.go#L268-L309 |
139,045 | andygrunwald/go-trending | trending.go | newDeveloper | func (t *Trending) newDeveloper(name, fullName string, linkURL, avatarURL *url.URL) Developer {
return Developer{
ID: t.getUserIDBasedOnAvatarURL(avatarURL),
DisplayName: name,
FullName: fullName,
URL: linkURL,
Avatar: avatarURL,
}
} | go | func (t *Trending) newDeveloper(name, fullName string, linkURL, avatarURL *url.URL) Developer {
return Developer{
ID: t.getUserIDBasedOnAvatarURL(avatarURL),
DisplayName: name,
FullName: fullName,
URL: linkURL,
Avatar: avatarURL,
}
} | [
"func",
"(",
"t",
"*",
"Trending",
")",
"newDeveloper",
"(",
"name",
",",
"fullName",
"string",
",",
"linkURL",
",",
"avatarURL",
"*",
"url",
".",
"URL",
")",
"Developer",
"{",
"return",
"Developer",
"{",
"ID",
":",
"t",
".",
"getUserIDBasedOnAvatarURL",
... | // newDeveloper is a utility function to create a new Developer | [
"newDeveloper",
"is",
"a",
"utility",
"function",
"to",
"create",
"a",
"new",
"Developer"
] | 5a4d422f8977c920038cdd9523a0c5e711053387 | https://github.com/andygrunwald/go-trending/blob/5a4d422f8977c920038cdd9523a0c5e711053387/trending.go#L363-L371 |
139,046 | andygrunwald/go-trending | trending.go | buildAvatarURL | func (t *Trending) buildAvatarURL(avatar string, exists bool) *url.URL {
if exists == false {
return nil
}
avatarURL, err := url.Parse(avatar)
if err != nil {
return nil
}
// Remove s parameter
// The "s" parameter controls the size of the avatar
q := avatarURL.Query()
q.Del("s")
avatarURL.RawQuery = q.... | go | func (t *Trending) buildAvatarURL(avatar string, exists bool) *url.URL {
if exists == false {
return nil
}
avatarURL, err := url.Parse(avatar)
if err != nil {
return nil
}
// Remove s parameter
// The "s" parameter controls the size of the avatar
q := avatarURL.Query()
q.Del("s")
avatarURL.RawQuery = q.... | [
"func",
"(",
"t",
"*",
"Trending",
")",
"buildAvatarURL",
"(",
"avatar",
"string",
",",
"exists",
"bool",
")",
"*",
"url",
".",
"URL",
"{",
"if",
"exists",
"==",
"false",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"avatarURL",
",",
"err",
":=",
"url",
... | // buildAvatarURL will build a url.URL out of the Avatar URL provided by Github | [
"buildAvatarURL",
"will",
"build",
"a",
"url",
".",
"URL",
"out",
"of",
"the",
"Avatar",
"URL",
"provided",
"by",
"Github"
] | 5a4d422f8977c920038cdd9523a0c5e711053387 | https://github.com/andygrunwald/go-trending/blob/5a4d422f8977c920038cdd9523a0c5e711053387/trending.go#L382-L399 |
139,047 | andygrunwald/go-trending | trending.go | getUserIDBasedOnAvatarURL | func (t *Trending) getUserIDBasedOnAvatarURL(avatarURL *url.URL) int {
id := 0
if avatarURL == nil {
return id
}
re := regexp.MustCompile("u/([0-9]+)")
if matches := re.FindStringSubmatch(avatarURL.Path); len(matches) >= 2 && len(matches[1]) > 0 {
id, _ = strconv.Atoi(matches[1])
}
return id
} | go | func (t *Trending) getUserIDBasedOnAvatarURL(avatarURL *url.URL) int {
id := 0
if avatarURL == nil {
return id
}
re := regexp.MustCompile("u/([0-9]+)")
if matches := re.FindStringSubmatch(avatarURL.Path); len(matches) >= 2 && len(matches[1]) > 0 {
id, _ = strconv.Atoi(matches[1])
}
return id
} | [
"func",
"(",
"t",
"*",
"Trending",
")",
"getUserIDBasedOnAvatarURL",
"(",
"avatarURL",
"*",
"url",
".",
"URL",
")",
"int",
"{",
"id",
":=",
"0",
"\n",
"if",
"avatarURL",
"==",
"nil",
"{",
"return",
"id",
"\n",
"}",
"\n\n",
"re",
":=",
"regexp",
".",
... | // getUserIDBasedOnAvatarLink determines the UserID based on an avatar link avatarURL | [
"getUserIDBasedOnAvatarLink",
"determines",
"the",
"UserID",
"based",
"on",
"an",
"avatar",
"link",
"avatarURL"
] | 5a4d422f8977c920038cdd9523a0c5e711053387 | https://github.com/andygrunwald/go-trending/blob/5a4d422f8977c920038cdd9523a0c5e711053387/trending.go#L402-L413 |
139,048 | andygrunwald/go-trending | trending.go | generateURL | func (t *Trending) generateURL(mode, time, language string) (*url.URL, error) {
urlStr := urlTrendingPath
if mode == modeDevelopers {
urlStr += urlDevelopersPath
}
u := t.appendBaseHostToPath(urlStr, true)
q := u.Query()
if len(time) > 0 {
q.Set("since", time)
}
if len(language) > 0 {
q.Set("l", languag... | go | func (t *Trending) generateURL(mode, time, language string) (*url.URL, error) {
urlStr := urlTrendingPath
if mode == modeDevelopers {
urlStr += urlDevelopersPath
}
u := t.appendBaseHostToPath(urlStr, true)
q := u.Query()
if len(time) > 0 {
q.Set("since", time)
}
if len(language) > 0 {
q.Set("l", languag... | [
"func",
"(",
"t",
"*",
"Trending",
")",
"generateURL",
"(",
"mode",
",",
"time",
",",
"language",
"string",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"urlStr",
":=",
"urlTrendingPath",
"\n",
"if",
"mode",
"==",
"modeDevelopers",
"{",
... | // generateURL will generate the correct URL to call the github site.
//
// Depending on mode, time and language it will set the correct pathes and query parameters. | [
"generateURL",
"will",
"generate",
"the",
"correct",
"URL",
"to",
"call",
"the",
"github",
"site",
".",
"Depending",
"on",
"mode",
"time",
"and",
"language",
"it",
"will",
"set",
"the",
"correct",
"pathes",
"and",
"query",
"parameters",
"."
] | 5a4d422f8977c920038cdd9523a0c5e711053387 | https://github.com/andygrunwald/go-trending/blob/5a4d422f8977c920038cdd9523a0c5e711053387/trending.go#L446-L465 |
139,049 | libp2p/go-flow-metrics | registry.go | ForEach | func (r *MeterRegistry) ForEach(iterFunc func(string, *Meter)) {
r.meters.Range(func(k, v interface{}) bool {
iterFunc(k.(string), v.(*Meter))
return true
})
} | go | func (r *MeterRegistry) ForEach(iterFunc func(string, *Meter)) {
r.meters.Range(func(k, v interface{}) bool {
iterFunc(k.(string), v.(*Meter))
return true
})
} | [
"func",
"(",
"r",
"*",
"MeterRegistry",
")",
"ForEach",
"(",
"iterFunc",
"func",
"(",
"string",
",",
"*",
"Meter",
")",
")",
"{",
"r",
".",
"meters",
".",
"Range",
"(",
"func",
"(",
"k",
",",
"v",
"interface",
"{",
"}",
")",
"bool",
"{",
"iterFun... | // ForEach calls the passed function for each registered meter. | [
"ForEach",
"calls",
"the",
"passed",
"function",
"for",
"each",
"registered",
"meter",
"."
] | b1aae8c25b4822de58289e6af21362f93753fa23 | https://github.com/libp2p/go-flow-metrics/blob/b1aae8c25b4822de58289e6af21362f93753fa23/registry.go#L30-L35 |
139,050 | libp2p/go-flow-metrics | meter.go | Mark | func (m *Meter) Mark(count uint64) {
if count > 0 && atomic.AddUint64(&m.accumulator, count) == count {
// I'm the first one to bump this above 0.
// Register it.
globalSweeper.Register(m)
}
} | go | func (m *Meter) Mark(count uint64) {
if count > 0 && atomic.AddUint64(&m.accumulator, count) == count {
// I'm the first one to bump this above 0.
// Register it.
globalSweeper.Register(m)
}
} | [
"func",
"(",
"m",
"*",
"Meter",
")",
"Mark",
"(",
"count",
"uint64",
")",
"{",
"if",
"count",
">",
"0",
"&&",
"atomic",
".",
"AddUint64",
"(",
"&",
"m",
".",
"accumulator",
",",
"count",
")",
"==",
"count",
"{",
"// I'm the first one to bump this above 0... | // Mark updates the total. | [
"Mark",
"updates",
"the",
"total",
"."
] | b1aae8c25b4822de58289e6af21362f93753fa23 | https://github.com/libp2p/go-flow-metrics/blob/b1aae8c25b4822de58289e6af21362f93753fa23/meter.go#L27-L33 |
139,051 | libp2p/go-flow-metrics | meter.go | Snapshot | func (m *Meter) Snapshot() Snapshot {
globalSweeper.mutex.RLock()
defer globalSweeper.mutex.RUnlock()
return m.snapshot
} | go | func (m *Meter) Snapshot() Snapshot {
globalSweeper.mutex.RLock()
defer globalSweeper.mutex.RUnlock()
return m.snapshot
} | [
"func",
"(",
"m",
"*",
"Meter",
")",
"Snapshot",
"(",
")",
"Snapshot",
"{",
"globalSweeper",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"defer",
"globalSweeper",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"m",
".",
"snapshot",
"\n",
"}"... | // Snapshot gets a consistent snapshot of the total and rate. | [
"Snapshot",
"gets",
"a",
"consistent",
"snapshot",
"of",
"the",
"total",
"and",
"rate",
"."
] | b1aae8c25b4822de58289e6af21362f93753fa23 | https://github.com/libp2p/go-flow-metrics/blob/b1aae8c25b4822de58289e6af21362f93753fa23/meter.go#L36-L40 |
139,052 | kevinburke/rest | client.go | NewClient | func NewClient(user, pass, base string) *Client {
return &Client{
ID: user,
Token: pass,
Client: defaultHttpClient,
Base: base,
UploadType: JSON,
ErrorParser: DefaultErrorParser,
}
} | go | func NewClient(user, pass, base string) *Client {
return &Client{
ID: user,
Token: pass,
Client: defaultHttpClient,
Base: base,
UploadType: JSON,
ErrorParser: DefaultErrorParser,
}
} | [
"func",
"NewClient",
"(",
"user",
",",
"pass",
",",
"base",
"string",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"ID",
":",
"user",
",",
"Token",
":",
"pass",
",",
"Client",
":",
"defaultHttpClient",
",",
"Base",
":",
"base",
",",
"Upload... | // NewClient returns a new Client with the given user and password. Base is the
// scheme+domain to hit for all requests. | [
"NewClient",
"returns",
"a",
"new",
"Client",
"with",
"the",
"given",
"user",
"and",
"password",
".",
"Base",
"is",
"the",
"scheme",
"+",
"domain",
"to",
"hit",
"for",
"all",
"requests",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/client.go#L57-L66 |
139,053 | kevinburke/rest | client.go | NewBearerClient | func NewBearerClient(token, base string) *Client {
return &Client{
ID: "",
Token: token,
Client: defaultHttpClient,
Base: base,
UploadType: JSON,
ErrorParser: DefaultErrorParser,
useBearerAuth: true,
}
} | go | func NewBearerClient(token, base string) *Client {
return &Client{
ID: "",
Token: token,
Client: defaultHttpClient,
Base: base,
UploadType: JSON,
ErrorParser: DefaultErrorParser,
useBearerAuth: true,
}
} | [
"func",
"NewBearerClient",
"(",
"token",
",",
"base",
"string",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"ID",
":",
"\"",
"\"",
",",
"Token",
":",
"token",
",",
"Client",
":",
"defaultHttpClient",
",",
"Base",
":",
"base",
",",
"UploadTyp... | // NewBearerClient returns a new Client configured to use Bearer authentication. | [
"NewBearerClient",
"returns",
"a",
"new",
"Client",
"configured",
"to",
"use",
"Bearer",
"authentication",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/client.go#L69-L79 |
139,054 | kevinburke/rest | client.go | DialSocket | func (c *Client) DialSocket(socket string, transport *http.Transport) {
dialSock := func(ctx context.Context, proto, addr string) (conn net.Conn, err error) {
return defaultDialer.DialContext(ctx, "unix", socket)
}
if transport == nil {
ht := http.DefaultTransport.(*http.Transport)
transport = &http.Transport{... | go | func (c *Client) DialSocket(socket string, transport *http.Transport) {
dialSock := func(ctx context.Context, proto, addr string) (conn net.Conn, err error) {
return defaultDialer.DialContext(ctx, "unix", socket)
}
if transport == nil {
ht := http.DefaultTransport.(*http.Transport)
transport = &http.Transport{... | [
"func",
"(",
"c",
"*",
"Client",
")",
"DialSocket",
"(",
"socket",
"string",
",",
"transport",
"*",
"http",
".",
"Transport",
")",
"{",
"dialSock",
":=",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"proto",
",",
"addr",
"string",
")",
"(",
"c... | // DialSocket configures c to use the provided socket and http.Transport to
// dial a Unix socket instead of a TCP port.
//
// If transport is nil, the settings from DefaultTransport are used. | [
"DialSocket",
"configures",
"c",
"to",
"use",
"the",
"provided",
"socket",
"and",
"http",
".",
"Transport",
"to",
"dial",
"a",
"Unix",
"socket",
"instead",
"of",
"a",
"TCP",
"port",
".",
"If",
"transport",
"is",
"nil",
"the",
"settings",
"from",
"DefaultTr... | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/client.go#L91-L124 |
139,055 | kevinburke/rest | client.go | NewRequest | func (c *Client) NewRequest(method, path string, body io.Reader) (*http.Request, error) {
req, err := http.NewRequest(method, c.Base+path, body)
if err != nil {
return nil, err
}
switch {
case c.useBearerAuth && c.Token != "":
req.Header.Add("Authorization", "Bearer "+c.Token)
case !c.useBearerAuth && (c.ID !... | go | func (c *Client) NewRequest(method, path string, body io.Reader) (*http.Request, error) {
req, err := http.NewRequest(method, c.Base+path, body)
if err != nil {
return nil, err
}
switch {
case c.useBearerAuth && c.Token != "":
req.Header.Add("Authorization", "Bearer "+c.Token)
case !c.useBearerAuth && (c.ID !... | [
"func",
"(",
"c",
"*",
"Client",
")",
"NewRequest",
"(",
"method",
",",
"path",
"string",
",",
"body",
"io",
".",
"Reader",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"m... | // NewRequest creates a new Request and sets basic auth based on the client's
// authentication information. | [
"NewRequest",
"creates",
"a",
"new",
"Request",
"and",
"sets",
"basic",
"auth",
"based",
"on",
"the",
"client",
"s",
"authentication",
"information",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/client.go#L128-L150 |
139,056 | kevinburke/rest | client.go | Do | func (c *Client) Do(r *http.Request, v interface{}) error {
var res *http.Response
var err error
if c.Client == nil {
res, err = defaultHttpClient.Do(r)
} else {
res, err = c.Client.Do(r)
}
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode >= 400 {
if c.ErrorParser != nil {
retur... | go | func (c *Client) Do(r *http.Request, v interface{}) error {
var res *http.Response
var err error
if c.Client == nil {
res, err = defaultHttpClient.Do(r)
} else {
res, err = c.Client.Do(r)
}
if err != nil {
return err
}
defer res.Body.Close()
if res.StatusCode >= 400 {
if c.ErrorParser != nil {
retur... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Do",
"(",
"r",
"*",
"http",
".",
"Request",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"var",
"res",
"*",
"http",
".",
"Response",
"\n",
"var",
"err",
"error",
"\n",
"if",
"c",
".",
"Client",
"=="... | // Do performs the HTTP request. If the HTTP response is in the 2xx range,
// Unmarshal the response body into v. If the response status code is 400 or
// above, attempt to Unmarshal the response into an Error. Otherwise return
// a generic http error. | [
"Do",
"performs",
"the",
"HTTP",
"request",
".",
"If",
"the",
"HTTP",
"response",
"is",
"in",
"the",
"2xx",
"range",
"Unmarshal",
"the",
"response",
"body",
"into",
"v",
".",
"If",
"the",
"response",
"status",
"code",
"is",
"400",
"or",
"above",
"attempt... | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/client.go#L156-L184 |
139,057 | kevinburke/rest | client.go | DefaultErrorParser | func DefaultErrorParser(resp *http.Response) error {
resBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
defer resp.Body.Close()
rerr := new(Error)
err = json.Unmarshal(resBody, rerr)
if err != nil {
return fmt.Errorf("invalid response body: %s", string(resBody))
}
if rerr.Title == "" {
... | go | func DefaultErrorParser(resp *http.Response) error {
resBody, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
defer resp.Body.Close()
rerr := new(Error)
err = json.Unmarshal(resBody, rerr)
if err != nil {
return fmt.Errorf("invalid response body: %s", string(resBody))
}
if rerr.Title == "" {
... | [
"func",
"DefaultErrorParser",
"(",
"resp",
"*",
"http",
".",
"Response",
")",
"error",
"{",
"resBody",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
... | // DefaultErrorParser attempts to parse the response body as a rest.Error. If
// it cannot do so, return an error containing the entire response body. | [
"DefaultErrorParser",
"attempts",
"to",
"parse",
"the",
"response",
"body",
"as",
"a",
"rest",
".",
"Error",
".",
"If",
"it",
"cannot",
"do",
"so",
"return",
"an",
"error",
"containing",
"the",
"entire",
"response",
"body",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/client.go#L188-L205 |
139,058 | kevinburke/rest | rest.go | ServerError | func ServerError(w http.ResponseWriter, r *http.Request, err error) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusInternalServerError]
handlerMu.RUnlock()
if ok {
r = ctxSetErr(r, err)
f.ServeHTTP(w, r)
} else {
defaultServerError(w, r, err)
}
} | go | func ServerError(w http.ResponseWriter, r *http.Request, err error) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusInternalServerError]
handlerMu.RUnlock()
if ok {
r = ctxSetErr(r, err)
f.ServeHTTP(w, r)
} else {
defaultServerError(w, r, err)
}
} | [
"func",
"ServerError",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"err",
"error",
")",
"{",
"handlerMu",
".",
"RLock",
"(",
")",
"\n",
"f",
",",
"ok",
":=",
"handlerMap",
"[",
"http",
".",
"StatusInternalServer... | // ServerError logs the error to the Logger, and then responds to the request
// with a generic 500 server error message. ServerError panics if err is nil. | [
"ServerError",
"logs",
"the",
"error",
"to",
"the",
"Logger",
"and",
"then",
"responds",
"to",
"the",
"request",
"with",
"a",
"generic",
"500",
"server",
"error",
"message",
".",
"ServerError",
"panics",
"if",
"err",
"is",
"nil",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/rest.go#L77-L87 |
139,059 | kevinburke/rest | rest.go | NotFound | func NotFound(w http.ResponseWriter, r *http.Request) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusNotFound]
handlerMu.RUnlock()
if ok {
f.ServeHTTP(w, r)
} else {
defaultNotFound(w, r)
}
} | go | func NotFound(w http.ResponseWriter, r *http.Request) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusNotFound]
handlerMu.RUnlock()
if ok {
f.ServeHTTP(w, r)
} else {
defaultNotFound(w, r)
}
} | [
"func",
"NotFound",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"handlerMu",
".",
"RLock",
"(",
")",
"\n",
"f",
",",
"ok",
":=",
"handlerMap",
"[",
"http",
".",
"StatusNotFound",
"]",
"\n",
"handlerMu",
"... | // NotFound returns a 404 Not Found error to the client. | [
"NotFound",
"returns",
"a",
"404",
"Not",
"Found",
"error",
"to",
"the",
"client",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/rest.go#L114-L123 |
139,060 | kevinburke/rest | rest.go | BadRequest | func BadRequest(w http.ResponseWriter, r *http.Request, err *Error) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusBadRequest]
handlerMu.RUnlock()
if ok {
r = ctxSetErr(r, err)
f.ServeHTTP(w, r)
} else {
defaultBadRequest(w, r, err)
}
} | go | func BadRequest(w http.ResponseWriter, r *http.Request, err *Error) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusBadRequest]
handlerMu.RUnlock()
if ok {
r = ctxSetErr(r, err)
f.ServeHTTP(w, r)
} else {
defaultBadRequest(w, r, err)
}
} | [
"func",
"BadRequest",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"err",
"*",
"Error",
")",
"{",
"handlerMu",
".",
"RLock",
"(",
")",
"\n",
"f",
",",
"ok",
":=",
"handlerMap",
"[",
"http",
".",
"StatusBadReque... | // BadRequest logs a 400 error and then returns a 400 response to the client. | [
"BadRequest",
"logs",
"a",
"400",
"error",
"and",
"then",
"returns",
"a",
"400",
"response",
"to",
"the",
"client",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/rest.go#L136-L146 |
139,061 | kevinburke/rest | rest.go | Gone | func Gone(w http.ResponseWriter, r *http.Request) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusGone]
handlerMu.RUnlock()
if ok {
f.ServeHTTP(w, r)
} else {
defaultGone(w, r)
}
} | go | func Gone(w http.ResponseWriter, r *http.Request) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusGone]
handlerMu.RUnlock()
if ok {
f.ServeHTTP(w, r)
} else {
defaultGone(w, r)
}
} | [
"func",
"Gone",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"handlerMu",
".",
"RLock",
"(",
")",
"\n",
"f",
",",
"ok",
":=",
"handlerMap",
"[",
"http",
".",
"StatusGone",
"]",
"\n",
"handlerMu",
".",
"R... | // Gone responds to the request with a 410 Gone error message | [
"Gone",
"responds",
"to",
"the",
"request",
"with",
"a",
"410",
"Gone",
"error",
"message"
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/rest.go#L155-L164 |
139,062 | kevinburke/rest | rest.go | NotAllowed | func NotAllowed(w http.ResponseWriter, r *http.Request) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusMethodNotAllowed]
handlerMu.RUnlock()
if ok {
f.ServeHTTP(w, r)
} else {
defaultNotAllowed(w, r)
}
} | go | func NotAllowed(w http.ResponseWriter, r *http.Request) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusMethodNotAllowed]
handlerMu.RUnlock()
if ok {
f.ServeHTTP(w, r)
} else {
defaultNotAllowed(w, r)
}
} | [
"func",
"NotAllowed",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"handlerMu",
".",
"RLock",
"(",
")",
"\n",
"f",
",",
"ok",
":=",
"handlerMap",
"[",
"http",
".",
"StatusMethodNotAllowed",
"]",
"\n",
"handl... | // NotAllowed returns a generic HTTP 405 Not Allowed status and response body
// to the client. | [
"NotAllowed",
"returns",
"a",
"generic",
"HTTP",
"405",
"Not",
"Allowed",
"status",
"and",
"response",
"body",
"to",
"the",
"client",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/rest.go#L205-L214 |
139,063 | kevinburke/rest | rest.go | Forbidden | func Forbidden(w http.ResponseWriter, r *http.Request, err *Error) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusForbidden]
handlerMu.RUnlock()
if ok {
r = ctxSetErr(r, err)
f.ServeHTTP(w, r)
} else {
defaultForbidden(w, r, err)
}
} | go | func Forbidden(w http.ResponseWriter, r *http.Request, err *Error) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusForbidden]
handlerMu.RUnlock()
if ok {
r = ctxSetErr(r, err)
f.ServeHTTP(w, r)
} else {
defaultForbidden(w, r, err)
}
} | [
"func",
"Forbidden",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"err",
"*",
"Error",
")",
"{",
"handlerMu",
".",
"RLock",
"(",
")",
"\n",
"f",
",",
"ok",
":=",
"handlerMap",
"[",
"http",
".",
"StatusForbidden... | // Forbidden returns a 403 Forbidden status code to the client, with the given
// Error object in the response body. | [
"Forbidden",
"returns",
"a",
"403",
"Forbidden",
"status",
"code",
"to",
"the",
"client",
"with",
"the",
"given",
"Error",
"object",
"in",
"the",
"response",
"body",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/rest.go#L228-L238 |
139,064 | kevinburke/rest | rest.go | NoContent | func NoContent(w http.ResponseWriter) {
// No custom handler since there's no custom behavior.
w.Header().Del("Content-Type")
w.WriteHeader(http.StatusNoContent)
} | go | func NoContent(w http.ResponseWriter) {
// No custom handler since there's no custom behavior.
w.Header().Del("Content-Type")
w.WriteHeader(http.StatusNoContent)
} | [
"func",
"NoContent",
"(",
"w",
"http",
".",
"ResponseWriter",
")",
"{",
"// No custom handler since there's no custom behavior.",
"w",
".",
"Header",
"(",
")",
".",
"Del",
"(",
"\"",
"\"",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent"... | // NoContent returns a 204 No Content message. | [
"NoContent",
"returns",
"a",
"204",
"No",
"Content",
"message",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/rest.go#L252-L256 |
139,065 | kevinburke/rest | rest.go | Unauthorized | func Unauthorized(w http.ResponseWriter, r *http.Request, domain string) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusUnauthorized]
handlerMu.RUnlock()
if ok {
r = ctxSetDomain(r, domain)
f.ServeHTTP(w, r)
} else {
defaultUnauthorized(w, r, domain)
}
} | go | func Unauthorized(w http.ResponseWriter, r *http.Request, domain string) {
handlerMu.RLock()
f, ok := handlerMap[http.StatusUnauthorized]
handlerMu.RUnlock()
if ok {
r = ctxSetDomain(r, domain)
f.ServeHTTP(w, r)
} else {
defaultUnauthorized(w, r, domain)
}
} | [
"func",
"Unauthorized",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"domain",
"string",
")",
"{",
"handlerMu",
".",
"RLock",
"(",
")",
"\n",
"f",
",",
"ok",
":=",
"handlerMap",
"[",
"http",
".",
"StatusUnauthori... | // Unauthorized sets the Domain in the request context | [
"Unauthorized",
"sets",
"the",
"Domain",
"in",
"the",
"request",
"context"
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/rest.go#L259-L269 |
139,066 | kevinburke/rest | ctx.go | CtxErr | func CtxErr(r *http.Request) error {
val := r.Context().Value(errCtx)
if val == nil {
return nil
}
return val.(error)
} | go | func CtxErr(r *http.Request) error {
val := r.Context().Value(errCtx)
if val == nil {
return nil
}
return val.(error)
} | [
"func",
"CtxErr",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"val",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"errCtx",
")",
"\n",
"if",
"val",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"val",
".... | // CtxErr returns an error that's been stored in the Request context. | [
"CtxErr",
"returns",
"an",
"error",
"that",
"s",
"been",
"stored",
"in",
"the",
"Request",
"context",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/ctx.go#L16-L22 |
139,067 | kevinburke/rest | ctx.go | CtxDomain | func CtxDomain(r *http.Request) string {
val := r.Context().Value(domainCtx)
if val == nil {
return ""
}
return val.(string)
} | go | func CtxDomain(r *http.Request) string {
val := r.Context().Value(domainCtx)
if val == nil {
return ""
}
return val.(string)
} | [
"func",
"CtxDomain",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"string",
"{",
"val",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"domainCtx",
")",
"\n",
"if",
"val",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",... | // CtxDomain returns a domain that's been set on the request. Use it to get the
// domain set on a 401 error handler. | [
"CtxDomain",
"returns",
"a",
"domain",
"that",
"s",
"been",
"set",
"on",
"the",
"request",
".",
"Use",
"it",
"to",
"get",
"the",
"domain",
"set",
"on",
"a",
"401",
"error",
"handler",
"."
] | 77c0c82d0ded0190f0dfece37d24b76e17b4bb73 | https://github.com/kevinburke/rest/blob/77c0c82d0ded0190f0dfece37d24b76e17b4bb73/ctx.go#L31-L37 |
139,068 | jfreymuth/vorbis | vorbis.go | IsHeader | func IsHeader(packet []byte) bool {
return len(packet) > 6 && packet[0]&1 == 1 &&
packet[1] == 'v' &&
packet[2] == 'o' &&
packet[3] == 'r' &&
packet[4] == 'b' &&
packet[5] == 'i' &&
packet[6] == 's'
} | go | func IsHeader(packet []byte) bool {
return len(packet) > 6 && packet[0]&1 == 1 &&
packet[1] == 'v' &&
packet[2] == 'o' &&
packet[3] == 'r' &&
packet[4] == 'b' &&
packet[5] == 'i' &&
packet[6] == 's'
} | [
"func",
"IsHeader",
"(",
"packet",
"[",
"]",
"byte",
")",
"bool",
"{",
"return",
"len",
"(",
"packet",
")",
">",
"6",
"&&",
"packet",
"[",
"0",
"]",
"&",
"1",
"==",
"1",
"&&",
"packet",
"[",
"1",
"]",
"==",
"'v'",
"&&",
"packet",
"[",
"2",
"]... | // IsHeader returns wether the packet is a vorbis header. | [
"IsHeader",
"returns",
"wether",
"the",
"packet",
"is",
"a",
"vorbis",
"header",
"."
] | 2f16367d086d143e8e946cc5ee24618147d673dc | https://github.com/jfreymuth/vorbis/blob/2f16367d086d143e8e946cc5ee24618147d673dc/vorbis.go#L62-L70 |
139,069 | motemen/go-quickfix | quickfix.go | removeFromStmtList | func removeFromStmtList(node ast.Node, list []ast.Stmt) bool {
for i, s := range list {
if s == node {
for ; i < len(list)-1; i++ {
list[i] = list[i+1]
}
list[len(list)-1] = &ast.EmptyStmt{}
return true
}
}
return false
} | go | func removeFromStmtList(node ast.Node, list []ast.Stmt) bool {
for i, s := range list {
if s == node {
for ; i < len(list)-1; i++ {
list[i] = list[i+1]
}
list[len(list)-1] = &ast.EmptyStmt{}
return true
}
}
return false
} | [
"func",
"removeFromStmtList",
"(",
"node",
"ast",
".",
"Node",
",",
"list",
"[",
"]",
"ast",
".",
"Stmt",
")",
"bool",
"{",
"for",
"i",
",",
"s",
":=",
"range",
"list",
"{",
"if",
"s",
"==",
"node",
"{",
"for",
";",
"i",
"<",
"len",
"(",
"list"... | // removeFromStmtList remove node from slice of statements list. This function
// modifies list in-place and pads rest of the slice with ast.EmptyStmt. | [
"removeFromStmtList",
"remove",
"node",
"from",
"slice",
"of",
"statements",
"list",
".",
"This",
"function",
"modifies",
"list",
"in",
"-",
"place",
"and",
"pads",
"rest",
"of",
"the",
"slice",
"with",
"ast",
".",
"EmptyStmt",
"."
] | 5c522febc6796f9c2ceabf9374a75490e2d268da | https://github.com/motemen/go-quickfix/blob/5c522febc6796f9c2ceabf9374a75490e2d268da/quickfix.go#L379-L391 |
139,070 | apcera/logray | logger.go | New | func New() *Logger {
defaultOutputMutex.RLock()
defer defaultOutputMutex.RUnlock()
logger := &Logger{
Fields: make(map[string]interface{}),
outputs: make([]*loggerOutputWrapper, len(defaultOutputs)),
}
copy(logger.outputs, defaultOutputs)
return logger
} | go | func New() *Logger {
defaultOutputMutex.RLock()
defer defaultOutputMutex.RUnlock()
logger := &Logger{
Fields: make(map[string]interface{}),
outputs: make([]*loggerOutputWrapper, len(defaultOutputs)),
}
copy(logger.outputs, defaultOutputs)
return logger
} | [
"func",
"New",
"(",
")",
"*",
"Logger",
"{",
"defaultOutputMutex",
".",
"RLock",
"(",
")",
"\n",
"defer",
"defaultOutputMutex",
".",
"RUnlock",
"(",
")",
"\n\n",
"logger",
":=",
"&",
"Logger",
"{",
"Fields",
":",
"make",
"(",
"map",
"[",
"string",
"]",... | // New returns a new Logger with the default configuration. | [
"New",
"returns",
"a",
"new",
"Logger",
"with",
"the",
"default",
"configuration",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L48-L59 |
139,071 | apcera/logray | logger.go | AddDefaultOutput | func AddDefaultOutput(uri string, classes ...LogClass) error {
// generate it
lo, err := createOutputWrapper(uri, classes)
if err != nil {
return err
}
if lo == nil {
return nil
}
// Lock the default outputs
defaultOutputMutex.Lock()
defer defaultOutputMutex.Unlock()
defaultOutputs = append(defaultOutput... | go | func AddDefaultOutput(uri string, classes ...LogClass) error {
// generate it
lo, err := createOutputWrapper(uri, classes)
if err != nil {
return err
}
if lo == nil {
return nil
}
// Lock the default outputs
defaultOutputMutex.Lock()
defer defaultOutputMutex.Unlock()
defaultOutputs = append(defaultOutput... | [
"func",
"AddDefaultOutput",
"(",
"uri",
"string",
",",
"classes",
"...",
"LogClass",
")",
"error",
"{",
"// generate it",
"lo",
",",
"err",
":=",
"createOutputWrapper",
"(",
"uri",
",",
"classes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
... | // AddDefaultOutput adds a new default output which will be used on newly
// created Loggers. | [
"AddDefaultOutput",
"adds",
"a",
"new",
"default",
"output",
"which",
"will",
"be",
"used",
"on",
"newly",
"created",
"Loggers",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L63-L78 |
139,072 | apcera/logray | logger.go | ResetDefaultLogLevel | func ResetDefaultLogLevel(classes ...LogClass) {
// Combine the output classes into just one
class := NONE
for _, c := range classes {
class |= c
}
defaultOutputMutex.Lock()
for _, o := range defaultOutputs {
o.Class = class
}
defaultOutputMutex.Unlock()
} | go | func ResetDefaultLogLevel(classes ...LogClass) {
// Combine the output classes into just one
class := NONE
for _, c := range classes {
class |= c
}
defaultOutputMutex.Lock()
for _, o := range defaultOutputs {
o.Class = class
}
defaultOutputMutex.Unlock()
} | [
"func",
"ResetDefaultLogLevel",
"(",
"classes",
"...",
"LogClass",
")",
"{",
"// Combine the output classes into just one",
"class",
":=",
"NONE",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"classes",
"{",
"class",
"|=",
"c",
"\n",
"}",
"\n\n",
"defaultOutputMut... | // ResetDefaultLogLevel can be used to reconfigure the existing default outputs
// all be at a new log level. | [
"ResetDefaultLogLevel",
"can",
"be",
"used",
"to",
"reconfigure",
"the",
"existing",
"default",
"outputs",
"all",
"be",
"at",
"a",
"new",
"log",
"level",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L98-L110 |
139,073 | apcera/logray | logger.go | Clone | func (logger *Logger) Clone() *Logger {
clone := &Logger{}
// copy the outputs
logger.outputMutex.RLock()
clone.outputs = make([]*loggerOutputWrapper, len(logger.outputs))
copy(clone.outputs, logger.outputs)
logger.outputMutex.RUnlock()
// copy the fields
clone.Fields = make(map[string]interface{}, len(logger... | go | func (logger *Logger) Clone() *Logger {
clone := &Logger{}
// copy the outputs
logger.outputMutex.RLock()
clone.outputs = make([]*loggerOutputWrapper, len(logger.outputs))
copy(clone.outputs, logger.outputs)
logger.outputMutex.RUnlock()
// copy the fields
clone.Fields = make(map[string]interface{}, len(logger... | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"Clone",
"(",
")",
"*",
"Logger",
"{",
"clone",
":=",
"&",
"Logger",
"{",
"}",
"\n\n",
"// copy the outputs",
"logger",
".",
"outputMutex",
".",
"RLock",
"(",
")",
"\n",
"clone",
".",
"outputs",
"=",
"make",
... | // Clone returns a new Logger object and copies over the configuration and all
// fields along with it. | [
"Clone",
"returns",
"a",
"new",
"Logger",
"object",
"and",
"copies",
"over",
"the",
"configuration",
"and",
"all",
"fields",
"along",
"with",
"it",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L114-L129 |
139,074 | apcera/logray | logger.go | AddOutput | func (logger *Logger) AddOutput(uri string, classes ...LogClass) error {
// generate it
lo, err := createOutputWrapper(uri, classes)
if err != nil {
return err
}
if lo == nil {
return nil
}
// Lock our outputs
logger.outputMutex.Lock()
defer logger.outputMutex.Unlock()
logger.outputs = append(logger.outp... | go | func (logger *Logger) AddOutput(uri string, classes ...LogClass) error {
// generate it
lo, err := createOutputWrapper(uri, classes)
if err != nil {
return err
}
if lo == nil {
return nil
}
// Lock our outputs
logger.outputMutex.Lock()
defer logger.outputMutex.Unlock()
logger.outputs = append(logger.outp... | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"AddOutput",
"(",
"uri",
"string",
",",
"classes",
"...",
"LogClass",
")",
"error",
"{",
"// generate it",
"lo",
",",
"err",
":=",
"createOutputWrapper",
"(",
"uri",
",",
"classes",
")",
"\n",
"if",
"err",
"!=",... | // AddOutput adds a new output for the Logger based on the provided URI. | [
"AddOutput",
"adds",
"a",
"new",
"output",
"for",
"the",
"Logger",
"based",
"on",
"the",
"provided",
"URI",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L132-L147 |
139,075 | apcera/logray | logger.go | UpdateOutput | func (logger *Logger) UpdateOutput(uri string, classes ...LogClass) error {
u, err := url.Parse(uri)
if err != nil {
return err
}
class := NONE
for _, c := range classes {
class |= c
}
newoutputs := make([]*loggerOutputWrapper, 0)
// Lock our outputs
logger.outputMutex.Lock()
defer logger.outputMutex.U... | go | func (logger *Logger) UpdateOutput(uri string, classes ...LogClass) error {
u, err := url.Parse(uri)
if err != nil {
return err
}
class := NONE
for _, c := range classes {
class |= c
}
newoutputs := make([]*loggerOutputWrapper, 0)
// Lock our outputs
logger.outputMutex.Lock()
defer logger.outputMutex.U... | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"UpdateOutput",
"(",
"uri",
"string",
",",
"classes",
"...",
"LogClass",
")",
"error",
"{",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"uri",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err"... | // UpdateOutput updates an existing output matching for an URI scheme
// and exact classes match. For ex. if classes passed here are, DEBUG
// and ERROR, it will update Outputs with Class equals to DEBUG|ERROR. | [
"UpdateOutput",
"updates",
"an",
"existing",
"output",
"matching",
"for",
"an",
"URI",
"scheme",
"and",
"exact",
"classes",
"match",
".",
"For",
"ex",
".",
"if",
"classes",
"passed",
"here",
"are",
"DEBUG",
"and",
"ERROR",
"it",
"will",
"update",
"Outputs",
... | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L152-L196 |
139,076 | apcera/logray | logger.go | ResetOutput | func (logger *Logger) ResetOutput() {
logger.outputMutex.Lock()
logger.outputs = make([]*loggerOutputWrapper, 0)
logger.outputMutex.Unlock()
} | go | func (logger *Logger) ResetOutput() {
logger.outputMutex.Lock()
logger.outputs = make([]*loggerOutputWrapper, 0)
logger.outputMutex.Unlock()
} | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"ResetOutput",
"(",
")",
"{",
"logger",
".",
"outputMutex",
".",
"Lock",
"(",
")",
"\n",
"logger",
".",
"outputs",
"=",
"make",
"(",
"[",
"]",
"*",
"loggerOutputWrapper",
",",
"0",
")",
"\n",
"logger",
".",
... | // ResetOutput clears all the previously defined outputs on the Logger. | [
"ResetOutput",
"clears",
"all",
"the",
"previously",
"defined",
"outputs",
"on",
"the",
"Logger",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L199-L203 |
139,077 | apcera/logray | logger.go | createOutputWrapper | func createOutputWrapper(uri string, classes []LogClass) (*loggerOutputWrapper, error) {
// If the caller didn't give us any classes to configure then we do
// nothing. This can be either an error or not, and since it is just as easy
// either way we define this as being a no op rather than error condition.
if len(... | go | func createOutputWrapper(uri string, classes []LogClass) (*loggerOutputWrapper, error) {
// If the caller didn't give us any classes to configure then we do
// nothing. This can be either an error or not, and since it is just as easy
// either way we define this as being a no op rather than error condition.
if len(... | [
"func",
"createOutputWrapper",
"(",
"uri",
"string",
",",
"classes",
"[",
"]",
"LogClass",
")",
"(",
"*",
"loggerOutputWrapper",
",",
"error",
")",
"{",
"// If the caller didn't give us any classes to configure then we do",
"// nothing. This can be either an error or not, and s... | // createOutputWrapper generates a new loggerOutputWrapper based on the passed
// parameters. It will return an error if it fails to generate the output. It
// will return nil, nil if there are no classes specified. | [
"createOutputWrapper",
"generates",
"a",
"new",
"loggerOutputWrapper",
"based",
"on",
"the",
"passed",
"parameters",
".",
"It",
"will",
"return",
"an",
"error",
"if",
"it",
"fails",
"to",
"generate",
"the",
"output",
".",
"It",
"will",
"return",
"nil",
"nil",
... | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L208-L223 |
139,078 | apcera/logray | logger.go | createOutputWrapperForClass | func createOutputWrapperForClass(uri string, class LogClass) (*loggerOutputWrapper, error) {
// Generate the output wrapper or capture the cached one
ow, err := newOutput(uri)
if err != nil {
return nil, err
}
// generate the wrapper
lo := &loggerOutputWrapper{Class: class, OutputWrapper: ow}
return lo, nil
} | go | func createOutputWrapperForClass(uri string, class LogClass) (*loggerOutputWrapper, error) {
// Generate the output wrapper or capture the cached one
ow, err := newOutput(uri)
if err != nil {
return nil, err
}
// generate the wrapper
lo := &loggerOutputWrapper{Class: class, OutputWrapper: ow}
return lo, nil
} | [
"func",
"createOutputWrapperForClass",
"(",
"uri",
"string",
",",
"class",
"LogClass",
")",
"(",
"*",
"loggerOutputWrapper",
",",
"error",
")",
"{",
"// Generate the output wrapper or capture the cached one",
"ow",
",",
"err",
":=",
"newOutput",
"(",
"uri",
")",
"\n... | // createOutputWrapperForClass generates a new loggerOutputWrapper based on the passed
// parameters. It will return an error if it fails to generate the output. | [
"createOutputWrapperForClass",
"generates",
"a",
"new",
"loggerOutputWrapper",
"based",
"on",
"the",
"passed",
"parameters",
".",
"It",
"will",
"return",
"an",
"error",
"if",
"it",
"fails",
"to",
"generate",
"the",
"output",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L227-L237 |
139,079 | apcera/logray | logger.go | RemoveFields | func (logger *Logger) RemoveFields(keys ...string) {
for _, s := range keys {
delete(logger.Fields, s)
}
} | go | func (logger *Logger) RemoveFields(keys ...string) {
for _, s := range keys {
delete(logger.Fields, s)
}
} | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"RemoveFields",
"(",
"keys",
"...",
"string",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"keys",
"{",
"delete",
"(",
"logger",
".",
"Fields",
",",
"s",
")",
"\n",
"}",
"\n",
"}"
] | // RemoveFields will remove any of the mentioned keys from the Logger's Fields. | [
"RemoveFields",
"will",
"remove",
"any",
"of",
"the",
"mentioned",
"keys",
"from",
"the",
"Logger",
"s",
"Fields",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L245-L249 |
139,080 | apcera/logray | logger.go | SetFields | func (logger *Logger) SetFields(fields map[string]interface{}) {
for k, v := range fields {
logger.Fields[k] = v
}
} | go | func (logger *Logger) SetFields(fields map[string]interface{}) {
for k, v := range fields {
logger.Fields[k] = v
}
} | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"SetFields",
"(",
"fields",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"fields",
"{",
"logger",
".",
"Fields",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
... | // SetFields can be used to copy all of the values in the provided fields map to
// the current Logger. | [
"SetFields",
"can",
"be",
"used",
"to",
"copy",
"all",
"of",
"the",
"values",
"in",
"the",
"provided",
"fields",
"map",
"to",
"the",
"current",
"Logger",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L253-L257 |
139,081 | apcera/logray | logger.go | SetField | func (logger *Logger) SetField(key string, value interface{}) {
logger.Fields[key] = value
} | go | func (logger *Logger) SetField(key string, value interface{}) {
logger.Fields[key] = value
} | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"SetField",
"(",
"key",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"logger",
".",
"Fields",
"[",
"key",
"]",
"=",
"value",
"\n",
"}"
] | // SetField is used to set the specified field to the provided value on the
// current Logger. | [
"SetField",
"is",
"used",
"to",
"set",
"the",
"specified",
"field",
"to",
"the",
"provided",
"value",
"on",
"the",
"current",
"Logger",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L261-L263 |
139,082 | apcera/logray | logger.go | log | func (logger *Logger) log(logClass LogClass, message string) {
ld := logger.newLineData(logClass, message)
b := &backgroundLineLogger{
lineData: *ld,
logger: logger,
}
transitChannel <- b
} | go | func (logger *Logger) log(logClass LogClass, message string) {
ld := logger.newLineData(logClass, message)
b := &backgroundLineLogger{
lineData: *ld,
logger: logger,
}
transitChannel <- b
} | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"log",
"(",
"logClass",
"LogClass",
",",
"message",
"string",
")",
"{",
"ld",
":=",
"logger",
".",
"newLineData",
"(",
"logClass",
",",
"message",
")",
"\n",
"b",
":=",
"&",
"backgroundLineLogger",
"{",
"lineDat... | // log is the internal function which creates the line data for the message and
// pushes it onto the transit channel. | [
"log",
"is",
"the",
"internal",
"function",
"which",
"creates",
"the",
"line",
"data",
"for",
"the",
"message",
"and",
"pushes",
"it",
"onto",
"the",
"transit",
"channel",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L342-L349 |
139,083 | apcera/logray | logger.go | Flush | func (logger *Logger) Flush() {
b := &backgroundFlusher{
logger: logger,
updateChan: make(chan struct{}),
}
transitChannel <- b
<-b.updateChan
} | go | func (logger *Logger) Flush() {
b := &backgroundFlusher{
logger: logger,
updateChan: make(chan struct{}),
}
transitChannel <- b
<-b.updateChan
} | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"Flush",
"(",
")",
"{",
"b",
":=",
"&",
"backgroundFlusher",
"{",
"logger",
":",
"logger",
",",
"updateChan",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"}",
"\n",
"transitChannel",
"<-",
"b",
... | // Flush is used to ensure the logger has flushed all queued log lines to its
// outputs before returning. | [
"Flush",
"is",
"used",
"to",
"ensure",
"the",
"logger",
"has",
"flushed",
"all",
"queued",
"log",
"lines",
"to",
"its",
"outputs",
"before",
"returning",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L353-L360 |
139,084 | apcera/logray | logger.go | newLineData | func (logger *Logger) newLineData(logClass LogClass, message string) *LineData {
ld := &LineData{
Message: message,
Class: logClass,
TimeStamp: time.Now(),
}
ld.Fields = make(map[string]interface{}, len(logger.Fields))
for k, v := range logger.Fields {
ld.Fields[k] = v
}
packageFilenameLine(ld, 4)... | go | func (logger *Logger) newLineData(logClass LogClass, message string) *LineData {
ld := &LineData{
Message: message,
Class: logClass,
TimeStamp: time.Now(),
}
ld.Fields = make(map[string]interface{}, len(logger.Fields))
for k, v := range logger.Fields {
ld.Fields[k] = v
}
packageFilenameLine(ld, 4)... | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"newLineData",
"(",
"logClass",
"LogClass",
",",
"message",
"string",
")",
"*",
"LineData",
"{",
"ld",
":=",
"&",
"LineData",
"{",
"Message",
":",
"message",
",",
"Class",
":",
"logClass",
",",
"TimeStamp",
":",... | // newLineData creates the struct that wraps a log message and will capture the
// source of the logging message from the stack. | [
"newLineData",
"creates",
"the",
"struct",
"that",
"wraps",
"a",
"log",
"message",
"and",
"will",
"capture",
"the",
"source",
"of",
"the",
"logging",
"message",
"from",
"the",
"stack",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logger.go#L364-L381 |
139,085 | apcera/logray | logclass.go | String | func (l LogClass) String() string {
switch l {
case NONE:
return "none"
case TRACE:
return "trace"
case TRACEPLUS:
return "trace+"
case DEBUG:
return "debug"
case DEBUGPLUS:
return "debug+"
case INFO:
return "info"
case INFOPLUS:
return "info+"
case WARN:
return "warn"
case WARNPLUS:
return ... | go | func (l LogClass) String() string {
switch l {
case NONE:
return "none"
case TRACE:
return "trace"
case TRACEPLUS:
return "trace+"
case DEBUG:
return "debug"
case DEBUGPLUS:
return "debug+"
case INFO:
return "info"
case INFOPLUS:
return "info+"
case WARN:
return "warn"
case WARNPLUS:
return ... | [
"func",
"(",
"l",
"LogClass",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"l",
"{",
"case",
"NONE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"TRACE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"TRACEPLUS",
":",
"return",
"\"",
"\"",
"\n",
"case... | // Returns string representation of the given class. | [
"Returns",
"string",
"representation",
"of",
"the",
"given",
"class",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logclass.go#L14-L55 |
139,086 | apcera/logray | logclass.go | ParseLogClass | func ParseLogClass(s string) (LogClass, error) {
switch strings.ToLower(s) {
case "none":
return NONE, nil
case "trace":
return TRACE, nil
case "trace+":
return TRACEPLUS, nil
case "debug":
return DEBUG, nil
case "debug+":
return DEBUGPLUS, nil
case "info":
return INFO, nil
case "info+":
return IN... | go | func ParseLogClass(s string) (LogClass, error) {
switch strings.ToLower(s) {
case "none":
return NONE, nil
case "trace":
return TRACE, nil
case "trace+":
return TRACEPLUS, nil
case "debug":
return DEBUG, nil
case "debug+":
return DEBUGPLUS, nil
case "info":
return INFO, nil
case "info+":
return IN... | [
"func",
"ParseLogClass",
"(",
"s",
"string",
")",
"(",
"LogClass",
",",
"error",
")",
"{",
"switch",
"strings",
".",
"ToLower",
"(",
"s",
")",
"{",
"case",
"\"",
"\"",
":",
"return",
"NONE",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"TRA... | // Parses a logclass string into a LogClass object. This call is case
// insensitive. If the string is not recognised then an error will be returned
// and LogClass will be set to NONE. | [
"Parses",
"a",
"logclass",
"string",
"into",
"a",
"LogClass",
"object",
".",
"This",
"call",
"is",
"case",
"insensitive",
".",
"If",
"the",
"string",
"is",
"not",
"recognised",
"then",
"an",
"error",
"will",
"be",
"returned",
"and",
"LogClass",
"will",
"be... | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/logclass.go#L60-L92 |
139,087 | apcera/logray | util.go | packageFilenameLine | func packageFilenameLine(ld *LineData, depth int) {
i, filename, linenum, ok := runtime.Caller(depth)
if !ok {
return
}
// Strip the directory from the filename. Even on Windows this is slash
// delimited. See https://github.com/golang/go/issues/3335.
fileParts := strings.Split(filename, "/")
ld.SourceFile = ... | go | func packageFilenameLine(ld *LineData, depth int) {
i, filename, linenum, ok := runtime.Caller(depth)
if !ok {
return
}
// Strip the directory from the filename. Even on Windows this is slash
// delimited. See https://github.com/golang/go/issues/3335.
fileParts := strings.Split(filename, "/")
ld.SourceFile = ... | [
"func",
"packageFilenameLine",
"(",
"ld",
"*",
"LineData",
",",
"depth",
"int",
")",
"{",
"i",
",",
"filename",
",",
"linenum",
",",
"ok",
":=",
"runtime",
".",
"Caller",
"(",
"depth",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n\n",
"... | // packageFilenameLine updates the LineData to include the package, function,
// source file, and line number. | [
"packageFilenameLine",
"updates",
"the",
"LineData",
"to",
"include",
"the",
"package",
"function",
"source",
"file",
"and",
"line",
"number",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/util.go#L13-L42 |
139,088 | apcera/logray | util.go | gatherStack | func gatherStack() string {
root := runtime.GOROOT()
stack := make([]string, 0, 10)
pc := make([]uintptr, 10)
depth := runtime.Callers(4, pc)
for i := 0; i < depth; i++ {
f := runtime.FuncForPC(pc[i])
file, line := f.FileLine(pc[i])
if strings.HasPrefix(file, root) {
continue
}
path := strings.Split(... | go | func gatherStack() string {
root := runtime.GOROOT()
stack := make([]string, 0, 10)
pc := make([]uintptr, 10)
depth := runtime.Callers(4, pc)
for i := 0; i < depth; i++ {
f := runtime.FuncForPC(pc[i])
file, line := f.FileLine(pc[i])
if strings.HasPrefix(file, root) {
continue
}
path := strings.Split(... | [
"func",
"gatherStack",
"(",
")",
"string",
"{",
"root",
":=",
"runtime",
".",
"GOROOT",
"(",
")",
"\n",
"stack",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"10",
")",
"\n",
"pc",
":=",
"make",
"(",
"[",
"]",
"uintptr",
",",
"10",
")"... | // gatherStack generates a stack trace to attach to error messages. | [
"gatherStack",
"generates",
"a",
"stack",
"trace",
"to",
"attach",
"to",
"error",
"messages",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/util.go#L45-L68 |
139,089 | apcera/logray | output.go | AddNewOutputFunc | func AddNewOutputFunc(name string, f NewOutputFunc) bool {
updateMutex.Lock()
defer updateMutex.Unlock()
return lockedAddNewOutputFunc(name, f)
} | go | func AddNewOutputFunc(name string, f NewOutputFunc) bool {
updateMutex.Lock()
defer updateMutex.Unlock()
return lockedAddNewOutputFunc(name, f)
} | [
"func",
"AddNewOutputFunc",
"(",
"name",
"string",
",",
"f",
"NewOutputFunc",
")",
"bool",
"{",
"updateMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"updateMutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"lockedAddNewOutputFunc",
"(",
"name",
",",
"f",
")... | // Adds a new output type to the map of possible outputs. This defines the
// Scheme that will be provided via the URL. Fragments are managed by the Output
// system rather than being dealt with in this function. | [
"Adds",
"a",
"new",
"output",
"type",
"to",
"the",
"map",
"of",
"possible",
"outputs",
".",
"This",
"defines",
"the",
"Scheme",
"that",
"will",
"be",
"provided",
"via",
"the",
"URL",
".",
"Fragments",
"are",
"managed",
"by",
"the",
"Output",
"system",
"r... | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/output.go#L72-L76 |
139,090 | apcera/logray | output.go | lockedSetupOutputMap | func lockedSetupOutputMap() {
newOutputFuncMap = make(map[string]NewOutputFunc, 100)
newOutputFuncMap["stdout"] = newOutputFuncStdout
newOutputFuncMap["stderr"] = newOutputFuncStderr
newOutputFuncMap["file"] = newOutputFuncFile
newOutputFuncMap["fd"] = newOutputFuncFd
newOutputFuncMap["discard"] = newOutputFuncDi... | go | func lockedSetupOutputMap() {
newOutputFuncMap = make(map[string]NewOutputFunc, 100)
newOutputFuncMap["stdout"] = newOutputFuncStdout
newOutputFuncMap["stderr"] = newOutputFuncStderr
newOutputFuncMap["file"] = newOutputFuncFile
newOutputFuncMap["fd"] = newOutputFuncFd
newOutputFuncMap["discard"] = newOutputFuncDi... | [
"func",
"lockedSetupOutputMap",
"(",
")",
"{",
"newOutputFuncMap",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"NewOutputFunc",
",",
"100",
")",
"\n",
"newOutputFuncMap",
"[",
"\"",
"\"",
"]",
"=",
"newOutputFuncStdout",
"\n",
"newOutputFuncMap",
"[",
"\"",
... | // Sets up the outputMap with all known URL Scheme parsers. | [
"Sets",
"up",
"the",
"outputMap",
"with",
"all",
"known",
"URL",
"Scheme",
"parsers",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/output.go#L79-L87 |
139,091 | apcera/logray | output.go | newOutput | func newOutput(uri string) (o *outputWrapper, err error) {
updateMutex.Lock()
defer updateMutex.Unlock()
return lockedNewOutput(uri)
} | go | func newOutput(uri string) (o *outputWrapper, err error) {
updateMutex.Lock()
defer updateMutex.Unlock()
return lockedNewOutput(uri)
} | [
"func",
"newOutput",
"(",
"uri",
"string",
")",
"(",
"o",
"*",
"outputWrapper",
",",
"err",
"error",
")",
"{",
"updateMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"updateMutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"lockedNewOutput",
"(",
"uri",
"... | // Creates a new Output destination and configures it as default as
// possible. | [
"Creates",
"a",
"new",
"Output",
"destination",
"and",
"configures",
"it",
"as",
"default",
"as",
"possible",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/output.go#L100-L104 |
139,092 | apcera/logray | iooutput.go | Write | func (o *ioOutput) Write(ld *LineData) error {
size := o.initialSize + len(ld.Message) + 1
buffer := bytes.NewBuffer(make([]byte, 0, size))
// Walk the formatting functions calling them so they can write to the output
// buffer where possible.
for _, f := range o.formatFuncs {
if err := f(ld, buffer); err != ni... | go | func (o *ioOutput) Write(ld *LineData) error {
size := o.initialSize + len(ld.Message) + 1
buffer := bytes.NewBuffer(make([]byte, 0, size))
// Walk the formatting functions calling them so they can write to the output
// buffer where possible.
for _, f := range o.formatFuncs {
if err := f(ld, buffer); err != ni... | [
"func",
"(",
"o",
"*",
"ioOutput",
")",
"Write",
"(",
"ld",
"*",
"LineData",
")",
"error",
"{",
"size",
":=",
"o",
".",
"initialSize",
"+",
"len",
"(",
"ld",
".",
"Message",
")",
"+",
"1",
"\n",
"buffer",
":=",
"bytes",
".",
"NewBuffer",
"(",
"ma... | // Write attempts to add a line to this output object. This may be buffered, or
// unbuffered so its not safe to assume that this call will not block. | [
"Write",
"attempts",
"to",
"add",
"a",
"line",
"to",
"this",
"output",
"object",
".",
"This",
"may",
"be",
"buffered",
"or",
"unbuffered",
"so",
"its",
"not",
"safe",
"to",
"assume",
"that",
"this",
"call",
"will",
"not",
"block",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/iooutput.go#L226-L251 |
139,093 | apcera/logray | iooutput.go | Flush | func (o *ioOutput) Flush() error {
if w, ok := o.writer.(flushWriter); ok {
return w.Flush()
}
if w, ok := o.writer.(syncWriter); ok {
return w.Sync()
}
return nil
} | go | func (o *ioOutput) Flush() error {
if w, ok := o.writer.(flushWriter); ok {
return w.Flush()
}
if w, ok := o.writer.(syncWriter); ok {
return w.Sync()
}
return nil
} | [
"func",
"(",
"o",
"*",
"ioOutput",
")",
"Flush",
"(",
")",
"error",
"{",
"if",
"w",
",",
"ok",
":=",
"o",
".",
"writer",
".",
"(",
"flushWriter",
")",
";",
"ok",
"{",
"return",
"w",
".",
"Flush",
"(",
")",
"\n",
"}",
"\n",
"if",
"w",
",",
"... | // Flushes all logs that have been buffered for writing to this output. | [
"Flushes",
"all",
"logs",
"that",
"have",
"been",
"buffered",
"for",
"writing",
"to",
"this",
"output",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/iooutput.go#L254-L262 |
139,094 | apcera/logray | iooutput.go | formatFunc | func (s staticBytes) formatFunc(ld *LineData, b *bytes.Buffer) error {
_, err := b.Write([]byte(s))
return err
} | go | func (s staticBytes) formatFunc(ld *LineData, b *bytes.Buffer) error {
_, err := b.Write([]byte(s))
return err
} | [
"func",
"(",
"s",
"staticBytes",
")",
"formatFunc",
"(",
"ld",
"*",
"LineData",
",",
"b",
"*",
"bytes",
".",
"Buffer",
")",
"error",
"{",
"_",
",",
"err",
":=",
"b",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"s",
")",
")",
"\n",
"return",
"err"... | // Can be used in the formatFuncs array | [
"Can",
"be",
"used",
"in",
"the",
"formatFuncs",
"array"
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/iooutput.go#L272-L275 |
139,095 | apcera/logray | iooutput.go | addStatic | func (fp *formatParser) addStatic(b []byte) {
if b == nil {
return
} else if len(fp.lastStatic) == 0 {
fp.lastStatic = b
} else {
fp.lastStatic = append(fp.lastStatic, b...)
}
} | go | func (fp *formatParser) addStatic(b []byte) {
if b == nil {
return
} else if len(fp.lastStatic) == 0 {
fp.lastStatic = b
} else {
fp.lastStatic = append(fp.lastStatic, b...)
}
} | [
"func",
"(",
"fp",
"*",
"formatParser",
")",
"addStatic",
"(",
"b",
"[",
"]",
"byte",
")",
"{",
"if",
"b",
"==",
"nil",
"{",
"return",
"\n",
"}",
"else",
"if",
"len",
"(",
"fp",
".",
"lastStatic",
")",
"==",
"0",
"{",
"fp",
".",
"lastStatic",
"... | // Adds a static string to the formatFuncs implementation. | [
"Adds",
"a",
"static",
"string",
"to",
"the",
"formatFuncs",
"implementation",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/iooutput.go#L310-L318 |
139,096 | apcera/logray | iooutput.go | commitStatic | func (fp *formatParser) commitStatic() {
if len(fp.lastStatic) == 0 {
return
}
f := staticBytes(fp.lastStatic).formatFunc
fp.formatFuncs = append(fp.formatFuncs, f)
fp.initialSize += len(fp.lastStatic)
fp.lastStatic = nil
} | go | func (fp *formatParser) commitStatic() {
if len(fp.lastStatic) == 0 {
return
}
f := staticBytes(fp.lastStatic).formatFunc
fp.formatFuncs = append(fp.formatFuncs, f)
fp.initialSize += len(fp.lastStatic)
fp.lastStatic = nil
} | [
"func",
"(",
"fp",
"*",
"formatParser",
")",
"commitStatic",
"(",
")",
"{",
"if",
"len",
"(",
"fp",
".",
"lastStatic",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"f",
":=",
"staticBytes",
"(",
"fp",
".",
"lastStatic",
")",
".",
"formatFunc",
"... | // Called when a series of static strings has ended. | [
"Called",
"when",
"a",
"series",
"of",
"static",
"strings",
"has",
"ended",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/iooutput.go#L321-L329 |
139,097 | apcera/logray | iooutput.go | addFormatFunc | func (fp *formatParser) addFormatFunc(
f func(*LineData, *bytes.Buffer) error, size int,
) {
fp.commitStatic()
fp.formatFuncs = append(fp.formatFuncs, f)
fp.initialSize += size
} | go | func (fp *formatParser) addFormatFunc(
f func(*LineData, *bytes.Buffer) error, size int,
) {
fp.commitStatic()
fp.formatFuncs = append(fp.formatFuncs, f)
fp.initialSize += size
} | [
"func",
"(",
"fp",
"*",
"formatParser",
")",
"addFormatFunc",
"(",
"f",
"func",
"(",
"*",
"LineData",
",",
"*",
"bytes",
".",
"Buffer",
")",
"error",
",",
"size",
"int",
",",
")",
"{",
"fp",
".",
"commitStatic",
"(",
")",
"\n",
"fp",
".",
"formatFu... | // Adds a format function to the formatFunc list. | [
"Adds",
"a",
"format",
"function",
"to",
"the",
"formatFunc",
"list",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/iooutput.go#L332-L338 |
139,098 | apcera/logray | iooutput.go | freshCode | func (fp *formatParser) freshCode(i int, r rune) error {
fp.start = i
fp.code = (*formatParser).codeCode
fp.next = (*formatParser).codeNext
fp.end = (*formatParser).codeEnd
return nil
} | go | func (fp *formatParser) freshCode(i int, r rune) error {
fp.start = i
fp.code = (*formatParser).codeCode
fp.next = (*formatParser).codeNext
fp.end = (*formatParser).codeEnd
return nil
} | [
"func",
"(",
"fp",
"*",
"formatParser",
")",
"freshCode",
"(",
"i",
"int",
",",
"r",
"rune",
")",
"error",
"{",
"fp",
".",
"start",
"=",
"i",
"\n",
"fp",
".",
"code",
"=",
"(",
"*",
"formatParser",
")",
".",
"codeCode",
"\n",
"fp",
".",
"next",
... | // Called when the parser is not currently parsing a static string and the next
// character in the format string is a code '%'. | [
"Called",
"when",
"the",
"parser",
"is",
"not",
"currently",
"parsing",
"a",
"static",
"string",
"and",
"the",
"next",
"character",
"in",
"the",
"format",
"string",
"is",
"a",
"code",
"%",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/iooutput.go#L342-L348 |
139,099 | apcera/logray | iooutput.go | freshNext | func (fp *formatParser) freshNext(i int, r rune) error {
fp.start = i
fp.code = (*formatParser).staticCode
fp.next = (*formatParser).staticNext
fp.end = (*formatParser).staticEnd
return nil
} | go | func (fp *formatParser) freshNext(i int, r rune) error {
fp.start = i
fp.code = (*formatParser).staticCode
fp.next = (*formatParser).staticNext
fp.end = (*formatParser).staticEnd
return nil
} | [
"func",
"(",
"fp",
"*",
"formatParser",
")",
"freshNext",
"(",
"i",
"int",
",",
"r",
"rune",
")",
"error",
"{",
"fp",
".",
"start",
"=",
"i",
"\n",
"fp",
".",
"code",
"=",
"(",
"*",
"formatParser",
")",
".",
"staticCode",
"\n",
"fp",
".",
"next",... | // Called when the parser is not currently parsing a static string and the next
// character in the format string is not a '%'. | [
"Called",
"when",
"the",
"parser",
"is",
"not",
"currently",
"parsing",
"a",
"static",
"string",
"and",
"the",
"next",
"character",
"in",
"the",
"format",
"string",
"is",
"not",
"a",
"%",
"."
] | 684fe44f71d86f7cc3b1ed98633c83351cb2cad7 | https://github.com/apcera/logray/blob/684fe44f71d86f7cc3b1ed98633c83351cb2cad7/iooutput.go#L352-L358 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.